Eclipse loses source location when optimization reduced from -O2

39 views Asked by At

Eclipse (Neon Milestone 2, CDT) can't locate main() in debug perspective when optimization is changed from -O2 in C++. Alternating between -O0 and -O2 consistently reproduces the problem. Eclipse is set to autogenerate makefiles.

1

There are 1 answers

1
Chandrayya G K On BEST ANSWER

This is a bug in eclipse CDT. I have filed a bug against eclipse CDT bugzilla see this. See this caution in CDT help guide.

The only solution available now for this problem is to manually changing the debug launch configuration and re-configure and rebuild the project. So before debug verify the compiler options(Pass -g and -O0)