Jump to content
  • Advertisement


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

Iron Eye

multiple files one compile

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

is there a quick tut on how to work with multiple files all interlinked somehow, I''m trying to organize my small game up by seperating the functions into different files according to the class they belong to, and one file which stores all the classes. But I get errors up the wazoo, saying this dosn''t have a type blah blah... ---
-Iron Eye
Cyrus Eye design  _//_  My personal site  _//_  Google

"Games usually keep me from making my own..."

Share this post

Link to post
Share on other sites
what i''d do is make another file and call it "include.h"

#include all the files in your game in that one file, and then #include that file into all the files in your game.



#include "MyFile.h"
#include "ThatFile.h"

//MyFile.h and ThatFile.h

#include "Include.h"


#include "Include.h"

that way, everything knows where everything else is.

Share this post

Link to post
Share on other sites
You can use the extern key word to get to stuff in other files.

You should write a header file to filled with all the functions you want to use from the files and include it.


void dosomething(void)


extern void dosomething(void);


#include "dosomething.h"

int main(void)
return 0;

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!