'Breakpoints won't hit on CLion

CLion gives the following hover message accompanied with a "no" sign instead of a breakpoint red dot:

This breakpoint will currently not hit. No executable code associated with the following line.

This also happens when I put a breakpoint on a print statement. The print statement does get printed in the std output. How can the line not be associated with executable code then?



Solution 1:[1]

This most likely means that the code is optimized out and will not be included in the executable you are running.

The breakpoint validation is a recent feature.

Solution 2:[2]

I'm on macOS, for me, the fix was to change the Generator option, which, in turn, generates the CMake options as follows enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Victor Sergienko
Solution 2 Andy