Windows question

Started by
3 comments, last by chillah 22 years, 5 months ago
Ok, say I am making a game (wow, think of that) and I have multiple files. Say I make one .h file with all of the main includes and variables used in almost every file. I include this .h file into all of the .cpp files. Almost every file has at least one function that requires the handle of the main window. My question is this: Can I use extern to put the handle of my main window in the .h file that I include in all of my other files.? Would this work? Edited by - chillah on November 16, 2001 3:26:53 PM
"I'm never alone, I'm alone all the time" - Glycerine-Bush"It starts with one thing" In The End-Linkin Park
Advertisement
That''s not a Windows question, it''s a C/C++ one.

Anyway, you can place your extern in the header file and include it in all your source files, but make sure to actually define the variable somewhere (ie without the ''extern''.)
Yep. Just try it.

But you have to define the handle in one of the implementation files (without extern).
I should press F5 from time to time...
Alright, thanks. I am kind of new to programming and am thankful for your help.
"I'm never alone, I'm alone all the time" - Glycerine-Bush"It starts with one thing" In The End-Linkin Park

This topic is closed to new replies.

Advertisement