Sign in to follow this  

.h and no ext. include differences / visual c++ vs. dev-c++

This topic is 4204 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey all, ok i got all the problems with errors out of the way while i'm trying to compile my game with visual c++ (trying to move from dev c++) and now it is crashing during runtime... the only differences are the compilers and 3 include files. i've changed 2 headers and added 1 to remove compile time errors: original (dev-c++/mingw): #include <string.h> #include <list.h> changed (visual c++): #include <algorithm> #include <string> #include <list> now everything compiles fine but like i said i get runtime errors based around stuff in the no extension incude files... now, i realise that the includes for dev c++ are slightly different to begin with and they aren't the same as the ones i'm using for vc++, but if all the same functions and uses are compiling correctly, why are there runtime errors when there used to be none? its really baffling me because i thought i would now be able to use vc++ as my primary ide since its compiling but i still can't... any ideas/suggestions about how to get this working would be greatly appreciated. thanks,

Share this post


Link to post
Share on other sites
STL headers don't have an extension, the C-style headers do. string.h is the C header, and should include functions like strcmp(). string is the C++ header, and includes std::string.

I don't know if that's different in DevCPP, but it's the "proper" way.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Dev C++ will generally give you a warning if you include , but go ahead and include for you.

For sting.h it won't do that because string.h is a valid C header file.

Bottom line is that is not the same as .

Share this post


Link to post
Share on other sites
Dev C++ will generally give you a warning if you include <list.h>, but go ahead and include <list> for you.

For sting.h it won't do that because string.h is a valid C header file.

Bottom line is that <sting.h> is not the same as <sting>.

Share this post


Link to post
Share on other sites
thanks for actually paying attention jpetrie:
i've been trying out the debugger since you asked for code where the errors occur and i've found it much more useful than others i've tried to use... bottom line: i've now got most of it working (minus a few bugs with memory when releasing)!
thanks for your help (sorry i didn't try it earlier - not much successful experience using debuggers till this point so was sceptical...),
thanks again,

Share this post


Link to post
Share on other sites
Runtime errors are typically due to logic failures. We can't comment on them unless you
  1. give us more information on the errors - specific messages, etc; or
  2. post the relevant code, assuming you've narrowed the error to a specific statement block.

Most people assumed you had a problem with header files because you made that the bulk of your post. The change in the header files is irrelevant, provided your code is correct; the code in the standard headers is banged on by hundreds of thousands of people, so it's unlikely that you've uncovered a bug they all missed.

In summary, Show Us The Code™.

Share this post


Link to post
Share on other sites
yeah sorry about that everyone...
i realised that (from Oluseyi) but it just seems that the compiler with VC++ is a fair bit more strict than mingw and my usage of strings in my then current (and working) code wasn't up to scratch, even though it did compile (so yeah there were just a couple of logic errors - i do mean only 2 or 3).
sorry to be such a rat in my last post - i do appreciate all suggestions and they did help me to realise where the problem was (ie. not the headers - my code). i guess it was the asking of the exact code that got me to really look more thoroughly for the problem and i pushed all other thoughts aside...as valid as they were.

thanks again for helping us out [smile]. i will definately be using vc++ and the debugger much more frequently now that i can use the ide so hopefully i won't have to come back here and winge as often [wink].

thanks again everyone who posted,

Share this post


Link to post
Share on other sites

This topic is 4204 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this