Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

chillah

Windows question

This topic is 6091 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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''.)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yep. Just try it.

But you have to define the handle in one of the implementation files (without extern).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I should press F5 from time to time...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!