Archived

This topic is now archived and is closed to further replies.

Squirell

Dev C++ Strangeness

Recommended Posts

So I''m making this app of mine and I get to this point and decide to test it. It compiles perfectly but then when i hit the run button in Dev C++ it does nothing. So I do debug and it says there is an access violation so I comment out the stuff i just added and it works fine again. But looking at the code theres nothing there that should cause an access violation. So I try again and get the same result...nothing happens. I''m kinda pisssed now because I now the codes is just fine but the compiler won''t take it. So this time instead of running it with Dev C++''s run button I run it from windows (double click on the exe). It works perfectly. Im really confused now because Dev C++ still doesnt run it. Whats going on here?

Share this post


Link to post
Share on other sites
Asking on the Bloodshed forums would probably be more productive than asking here. At the very least, if the problem is reproducible, you should file a bug report.


“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
— Brian W. Kernighan

Share this post


Link to post
Share on other sites
Make sure all the functions you are calling return a value. MinGW doesn''t give a warning or an error if a function doesn''t return a value so this can cause problems such as an access violation. Did for me anyway.

Share this post


Link to post
Share on other sites
quote:
Original post by Dark One
Make sure all the functions you are calling return a value. MinGW doesn''t give a warning or an error if a function doesn''t return a value so this can cause problems such as an access violation. Did for me anyway.
Add -Wall(warn all) to your compiler settings (Tools->Compiler Options...). That will add a bunch of other warnings, but it''s a good idea to handle them all. The gcc manual gives the complete list of warning flags.

Share this post


Link to post
Share on other sites
For added fun value: -Wall -ansi -pedantic


“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
— Brian W. Kernighan

Share this post


Link to post
Share on other sites
Chances are you had an incompatible older version of one of your object files lying around and it got built into your application. It conformed to the right interface so that linking was ok, but you had some incorrect code in it that interacted badly with the rest. I usually get this problem when file A depends on constants in file B, and then for unrelated reasons I have to change the constant values. The object file (well, .class file; I''m a Java programmer normally) has the old values built in. Oops.

Share this post


Link to post
Share on other sites