C++ Console application can not Debug

2018-07-09


We met a problem recently when we debugged a C++ Console application in both of Visual Studio 2017 and Visual Studio 2015: All breakpoints did not work (The debug could not stop at the breakpoint).

We searched from internet, one solution is setting Debug Information Format to "Program Database for Edit And Continue (/ZI)" for C/C++ Configuration on the project propertise, but it still did not work:

image

We tried other solutions which we could find out from internet, all did not work.

Finally, we tried to clean the entire solution (not clean the project) and rebuild solution , the debug breakpoint returned to work.

Problem came again: C++ Console application can not Debug

However, one day we copied this project into another bigger solution which includes more projects, and we set this project to Startup project to debug, the same problem came again, we could not debug it (any breakpoints were no more work).

We tried to clean entire solution, but this time it did NOT return to work.

Finally when we right click the solution and checked properties, we found our C++ console project was not set to build actually, when we checked the debug row on, the debugging breakpoints returned to work again.

image

We think it is a bug in Visual Studio 2017/2015.

Summary

1: Set "Program Database for Edit And Continue (/ZI)" for C/C++ Configuration on the project propertise;

2: Clean Solution;

3: Make sure the project is in build configuration;