Skip to main content
gamedev.net
🔒 Locked

Multiple .cpp files, one .h file?

Started by ParanoiaComplex 2 replies 500+ views
Original Post
ParanoiaComplex
ParanoiaComplex
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?
Eddycharly
Eddycharly
Declare the variables as extern if they are declared in a difernet .cpp file (instead of static).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.