[C++] Solve "No source available for main()" error when debugging on Eclipse

In Mac,

the issue image:

1. A existing cmake project on disk

2. import this project into Eclipse.

3 run cmake

cmake "Unix Makefile" .

4. Build and Run this project on Eclipse successfully 

5. After clicking Debug button on Eclipse, the following error appears:

"No source available for main()"

Solution:

At step 3, use the below command:

cmake . -DCMAKE_BUILD_TYPE=Debug

Then, the Eclipse debugging should work.

Reference:

"No source available for main()" while debugging in Eclipse IDE, ros.org

原文地址:https://www.cnblogs.com/TonyYPZhang/p/6643760.html