Jump to content
  • Advertisement


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


Multiple Source Files

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

Why doesn''t any thing work without tweaking for hours? I''ve used multiple source files before and it worked but now I''m working tutorials on www.andypike.com. Im on the fourth one and it uses multiple source files. I have a header that defines some variables and one that defines some functions. To keep them from redefining themselves in multiple source files I use
#if !defined(MYHEADERFILE)

//FUnctions and vars



Ive also tried #ifndef and it doesn''t work either. Heres the errors I''m getting
main.obj : error LNK2005: "void __cdecl ErrMsg(char *)" (?ErrMsg@@YAXPAD@Z) already defined in CGame.obj
main.obj : error LNK2005: "void __cdecl DxErrMsg(long,char *)" (?DxErrMsg@@YAXJPAD@Z) already defined in CGame.obj
Debug/zbuffer.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.  

Share this post

Link to post
Share on other sites
Not sure why it doesn''t work, but here is how I type it.

#ifndef __MY_HEADER__
#define __MY_HEADER__

.... code ....

#endif // end __MY_HEADER__

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!