• Advertisement
Sign in to follow this  

Multiple .cpp files, one .h file?

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

All of my files call main.h, which holds my directdraw display device, surface, and palette files. The first file listed in my side panel is display.cpp. Problem is, my variables only get defined for that .cpp file, and I need them in other files. I'm declaring my LPDIRECTDRAWSURFACE7 variables as static variables, because otherwise my compiler gives me the already defined error. How do I avoid the "already defined" error, but make the variables accessible by every file in my project?

Share this post


Link to post
Share on other sites
Advertisement
Declare the variables as extern if they are declared in a difernet .cpp file (instead of static).

Share this post


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

  • Advertisement