Advertisement

GLOBAL variables in multiple files ??

Started by June 14, 2001 12:33 PM
1 comment, last by Biberpelztrompete 23 years, 8 months ago
Hiho, how do I use a variable ( for example hwnd ) in more than one .cpp files ?? I created a window in main.cpp and I need the window handle in some other cpp files. I declared it in global.h which I included in all my .cpp files. But then I recieve a linker error which says that the variables declared in global.h are declared twice or more. What can I do to solve this ?? thx
you put

  extern HWND hwnd;    //extern type var;  


where you would declare your globals in the other cpp.
-------------------------------------------------Don't take life too seriously, you''ll never get out of it alive. -Bugs Bunny
Advertisement
Ah,
thanx !!

This topic is closed to new replies.

Advertisement