Jump to content
  • Advertisement
Sign in to follow this  

Including Header Files in C++

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

Hi, I'm using Dev C++ for my programming projects right now. So far, I haven't been able to include header files in my program. For example: I make a cpp file called main_O I use #include "main_O.cpp" to try to include the file into my project. It doesn't work. #include "main_O.h" or #include "main_O.hpp" don't work either. Anybody know how I include header files into my projects? Any help is greatly appreciated!

Share this post


Link to post
Share on other sites
Advertisement
What, specifically, doesn't work?

My guess would be, you're getting an error that says something like,
Compiling...xxx.cpp(3): Could not include file "main_O.cpp": file does not exist or path is incorrect
If so, make sure your file is actually named "main_O.cpp". If your file doesn't have a cpp extension, it's just named "main_O", you just want to write #include "main_O".

Is that the problem?

Share this post


Link to post
Share on other sites
Quote:
Original post by Futurulus
What, specifically, doesn't work?

My guess would be, you're getting an error that says something like,
Compiling...xxx.cpp(3): Could not include file "main_O.cpp": file does not exist or path is incorrect
If so, make sure your file is actually named "main_O.cpp". If your file doesn't have a cpp extension, it's just named "main_O", you just want to write #include "main_O".

Is that the problem?


Nope it still doesn't work sorry.

Share this post


Link to post
Share on other sites
Quote:
Original post by 3Dgonewild
Have you added the header(and the source) in the project(Project->add to project) ?


Thats almost guaranteed to be your problem. Do as suggested, I'll bet you'll find that all works smoothly. Well, unless your code is...

I'm just teasing. ;)

FlyingIsFun1217

Share this post


Link to post
Share on other sites
Quote:
Original post by megamoscha
You include headerfiles(h, hpp, hxx or whatever you use for it) not source files (c, c++, cpp, cc, cxx, ...)


In dev c++ ,if you don't include the source files you're getting a bunch of errors.....

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!