I am using scientific linux. I am trying to compile a project that uses a bunch of cpp files. Right now, it compiles successfully, but the values/data I'm getting are definitely wrong.
In the directory user/project/Build
, I enter make to compile and link all the cpp files. I then have to go to user/run/
and then type ./run.sh values.txt
When I go to directory /user/project/Build/bin
and then type gdb project
and then set breakpoints, there are no problems. But when I hit run, I always see Program exited with code 01
. It doesn't matter if I set breakpoints in main.cpp or another source file. Isn't gdb supposed to stop at the breakpoint?
main()
. Does it show the correct path inStarting program:
after yourun
? Usinggdb ./project
(an absolute path) is less error prone. Beyond that, this seems kind of impossible to solve unless you provide at least an SSCCE. Are you sayinggdb
does this with, e.g.hello world
? I bet it doesn't. You have to narrow down the difference. – goldilocks Feb 26 '15 at 22:11gdb ./project
. Not sure how I can provide an SSCCE. I have main.cpp and a bunch of other cpp files, and each of them have 1000s of lines of code. The program usually runs if I go touser/run
and then type./run.sh values.txt
– user4352158 Feb 26 '15 at 22:20program exited with code 01
is[Thread debugging using libthread_db enabled] warning: File "/opt/apps/ossw/applications/gcc/gcc-4.6/sl6/lib64/libstdc++.so.6.0.16-gdb.py" auto-loading has been declined by your 'auto-load safe-path' set to "/usr/share/gdb/auto-load:/usr/lib/debug:/usr/bin/mono-gdb.py". ProjectName -[function option] <parameter file>
– user4352158 Feb 26 '15 at 22:58.py
) used with C++ is for prettified dumps of standard container structures. Not loading it probably isn't the cause of your grief. Gilles' answer makes an excellent point, but if that doesn't solve things, you need to start with a breakpoint on the first line of code inmain()
. If things are still confused...you are perhaps in over your head. Debugging can break hearts, that is the nature of the beast. :( – goldilocks Feb 27 '15 at 01:15