• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

DEV C++ debugging issue

Joined
5/6/06
Messages
60
Points
16
When I try to use the debugger in Dev C++ it always says "your project does not have debugging info, do you want to enable debugging and rebuild your project?" - so I hit yes, it compiles and then it doesn't seem to do anything. I want to debug such that I can step through each line and see how things change.
 
You will have to set a breakpoint. That's how the debugger will know where to stop. If you don't set a break point, the debugger runs the whole program and only finishes at the end of the program.

I don't know how to set a breakpoint in Dev-C++. In Visual C++ you can do it clicking on the outside of the editor or through the Debug menu.
 
Frank, first set a breakpoint by clicking in front of the line, outside of the editor window, you will see a red checkpoint goes up...usually you set the breakpoint after the calls you want to watch. If you want to go through the whole program, then set it on or just before return 0. I have cin.get() just before return so i set my breakpoint on cin.get().

Then click on Debug or press F8. You will notice the debug window at the bottom of Dev-C++. Now click on Add Watch and enter the variable name you want to watch. Do this for each variable. You may need to click on Debug again to have Next Step, Step Info clickable.

Then just click on Next Step to have the debugger runs through each line and see how the variables change.
 
Even when I set a breakpoint, the debugger in DEV C++ does not seem to work. I seem to always get the message about 'no debuggging info available, do you want to create the file and recompile now?' - i click OK and it recompiles but does not debug. This prevents me from being able to open a window to view the output of my programs (unless I use the other cin.get() fix or just use Cygwin)...has anyone else experienced this with Dev C++?
 
frankm1342 said:
I seem to always get the message about 'no debuggging info available, do you want to create the file and recompile now?' - i click OK and it recompiles but does not debug.
This means you haven't set up the Linker to include debugging info. Follow the video to see how i set it up. It's under Tools -> Compiler Options -> Settings -> Linker

First, google and download these two Insight debugger packages

The first file is the source code Insight_Source.DevPak
The second file is the binary code Insight_Binary.DevPak

Download these to your desktop and follow my video instruction to install and setup your debugger.
 
Andy - thank you so much for that info - that video was amazing. There must be something else that Im doing incorrect. I have always had 'generate debugging info' enabled under the compiler/linker options. I also followed everything you showed us in the video. in fact, when i launched Insight, and tried to open a .cpp file for a simple 'hello world' program i made, i received an error message. very odd. i can continue to use the dev c++ combination, but it seems that I will have problems accessing a debugger!
 
Frank, you are almost there :D When you use Insight, open an exe, not cpp file :). if your code is test.cpp then after you compile and build, you should have a test.exe. Use Insight to open that test.exe file. Don't ask me why. I tried to open the test.cpp with Insight and had that error too :-
I look forward to hearing that you finally got it to work.
 
I'm cursed - that must be it - I launched my 'hello world' executable and Insight told me - "The executable has no debugging information" - it brought up a screen filled with addresses. i hit the run info and the dos-looking screen apeared. i hit the 'next' button in Insight and that screen printed 'hello world'. so Insight worked for me, sort of, but my system still tells me that I am not generating debugging info. I swear that I have that option checked in the compiler options of dev c++! i have this same problem when i use dev c++ at work and school too.
 
Ah hah, that means you got the Insight setup and working properly but somehow the Dev-C++ does not include debugging info in your compiled exe.
What version of Dev-C++ you got, did you go to Tools ->Check for updates/packages and after you connect to the devpark.org listing, check to see in the Installed package if you have the latest ones.
Dev-C++ should be 4.9.9.2
GNU debugger should be 6.3-1
binutils should be 2.16.91-20060119-1

If not, then download and update it. I don't see why you shouldn't get it to work, the only thing you need to turn on is the Linker debugging info, set to Yes.

Just to debugging purpose, I included here the test.exe file I ran in the video. You should download it and open it with Insight. I hope it will be ok this time.
 

Attachments

  • test_196.zip
    146.8 KB · Views: 50
Frank, can you do this for me
Open Dev-C++, Tools ->Compiler Options
On the first bar, Compiler, check on Add the following commands when calling compiler and then type -g3 -gstabs into the window below that box. Remember you have to check (tick) that choice. Now click Ok.
You should compile and build your code again. This time, it should have the debugging info.
 
Andy - thanks for the tips - I did everything you asked (added the commands and downloading the updated files) but it still gives me the same message. Very weird. Perhaps Im destined to never debug my programs - or maybe this is how Microsoft keeps people using VS6.0....they make sure the competitors programs dont work!
 
if you don't want Visual Studio, get a copy of NetBeans with the C++ plug-in. I have used it and it's pretty good.
 
if you don't want Visual Studio, get a copy of NetBeans with the C++ plug-in. I have used it and it's pretty good.


Netbeans 6.8 and 6.9beta has serious bugs on various linux distro and partly on Wintel platform. It is still good until they resolve the bugs.

Wanna learn more...use vim and emacs.

Alternatively you can try Kdevelop which is also quite good. I think it is in version 4 now.
 
i have used Netbeans as main tool in iReport and I haven't hit any bugs. The same apply to C++ in Linux. Maybe I haven't used whatever feature causes the problem. This only applies to Netbeans 6.8 in Ubuntu.

Vim and Emacs? I think you mean Vim OR emacs. Usually you are one or the other.
 
Linux

i have used Netbeans as main tool in iReport and I haven't hit any bugs. The same apply to C++ in Linux. Maybe I haven't used whatever feature causes the problem. This only applies to Netbeans 6.8 in Ubuntu.

Vim and Emacs? I think you mean Vim OR emacs. Usually you are one or the other.

Fedora and openSuse do have problems with Netbeans 6.8 and 6.9, check the Netbeans user forum. Something to do with Genome terminal issues. It happens most recently with Ubuntu 10.04 (Lucid).

Which OS are you running for your Netbeans? If it is Windows is ok.

---------- Post added at 07:03 PM ---------- Previous post was at 06:58 PM ----------

i have used Netbeans as main tool in iReport and I haven't hit any bugs. The same apply to C++ in Linux. Maybe I haven't used whatever feature causes the problem. This only applies to Netbeans 6.8 in Ubuntu.

Vim and Emacs? I think you mean Vim OR emacs. Usually you are one or the other.

VIM or Emacs vs. Vim and emacs!. This is not English lecture. I am not sure what do you mean. Nobody is trying to out smart the other here. Can I recommend Vim and emacs to someone to try out? By the way, many who has tried Vim, also tried emacs. Should we know more rather than less?

Please do not forget that this is an open forum. We share knowledge here with friends. I do not give advice to tell people what they should do...so please be humble when you share.
 
Back
Top