Advertisement

Using EXTERN in header or source file?

Started by September 20, 2000 09:17 AM
1 comment, last by cclements 24 years, 3 months ago
Gurus, I would like to have all my DirectX code in a module seperate from the module that has the template window code. However, other modules may need to "see" that lpdds is a LPDIRECTDRAWSURFACE. I know that this requires the use of the EXTERN keyword, but I cannot recall if it goes in the header file (*.h), and if the actual LPDRECTDRAWSURFACE declaration goes in the source file (*.cpp). I hope I have not confused anyone, I think this is a basic question. Any help would be greatly appeciated. Thanks in advance, --Chris
No signature files!!! =)
OK, lets say you have LPDIRECTDRAWSURFACE lpdds declared in your drawing.cpp. You can either extern it in drawing.h so all .cpp files that include it can see it, or you can extern it in each .cpp file that actually uses it. But make sure either way, that ddraw.h is included before you extern it so that the compiler knows what a LPDIRECTDRAWSURFACE is before it compiles those files.
----------------------
Modian
Advertisement
Thanks Modian!!
No signature files!!! =)

This topic is closed to new replies.

Advertisement