Sign in to follow this  

Problem Creating Window

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

This topic is 3953 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this