Multiple .cpp files, one .h file?

Started by
2 comments, last by Eddycharly 19 years, 9 months ago
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?
Advertisement
Does this article answer your question?
Thanks a lot. This is exactly what I was looking for.
Declare the variables as extern if they are declared in a difernet .cpp file (instead of static).

This topic is closed to new replies.

Advertisement