Jump to content
  • Advertisement
Sign in to follow this  
gunner_uk2000

Problem Creating Window

This topic is 4163 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

I am creating a C++ class to create a window, to be used as a Dialogue box. The handles to the current window and parent window need to be static so that the WndProc method can access them, however when trying to declare them as static members of the class, like so: protected: static HWND m_Parent; static HWND m_this; static HINSTANCE m_instance; I get the flowing error on compilation: vrExodus error LNK2001: unresolved external symbol "protected: static struct HWND__ * AbstractWindow::m_this" (?m_this@AbstractWindow@@1PAUHWND__@@A) Any Ideas? *note I am using inheirtance, but I don't think that is the problem as I get the same error when trying to declare them in the sub-class.*

Share this post


Link to post
Share on other sites
Advertisement
If you declare them as static in the classes header you need exactly one place where you actually put the variable.

This is usually in the accompanying .cpp file, put it like this (without the static keyword):

HWND AbstractWindow::m_this;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!