Jump to content
  • Advertisement
Sign in to follow this  
DjMaSh

header files!!!

This topic is 4237 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

Im having a bit of trouble working with header files. I have two files in my project, main.cpp and block.h. I include block.h from main.cpp as normal. I am using dev-c++ IDE. My problem is, if i put deliberate errors into block.h, the compiler doesn't pick them up until i make changes to main.cpp. It's like block.h is not actually being compiled separately. It is really frustrating because the changes I make to block.h aren't noted until i edit main.cpp and then save and recompile. ARGC!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
it's like block.h is not actually being compiled separately.

It's not :-), the C++ compiler compiles each translation unit (A source file plus all its #includes minus and thing #if'd out) separatly so if you have a header that isnt included in any of you source files then C++ never compiles it.

Edit: Also the compiler will GENERALLY only recompile the translation units that it knows have changed, to force it to compile everything there should be an option in your IDE along the lines of "Rebuild" or something (i havnt used Dev-C++ so im not sure exactly what it would be).

Share this post


Link to post
Share on other sites
Check that your header file is also included in your project. Not as an #include directive for the compiler, but actually included in the IDE project. If not, then whenever you click compile, the IDE isn't going to know to see if the header file was changed.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!