Debug C++ makefile project breakpoint not hit

已完成

Hi, 

I'm new to CLion, I've been running my code on terminal and wanted to try debugging using CLion interface. I have a custom Makefile, I already set the project as Makefile Project, edited configurations to select targets and executable, and so far I'm able to build and run my program successfully using CLion, however, I'm not able to access breakpoints on debug mode. I followed documentation example and read some posts, some recommend to link targets in a CMakefile, but I'd rather just stick with single Makefile, if possible.

The message I get is "The breakpoint will not currently be hit. No executable code is associated with this line", there's definitely something I'm missing in my configuration but I cannot find how to fix it.

I'm running CLion 2021.2.2, using Debian 10 in a Virtual Machine. Thanks in advance for the guidance.

0

I have the same problem and I'am also on Debian 10 so maybe that's something relevant.

0

Turned out it was my fault. I didn't know I have to run gcc with -g flag in order to debug correctly. So for anyone having the same issue, try to compile your code like this: gcc -g source_code.c -o executable

2

Thanks, I was missing the -g flag also. Added a debug target configuration to append the -g, recompiled and executed in debug mode in CLion, and could hit the first breakpoint. 

Also, if anyone gets to this post, I'm running on windows using WSL2 with debian, and it works like a charm, just set up WSL as toolchain

0

请先登录再写评论。