Advertisement Jump to content
Sign in to follow this  


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

Hi, i am currently learning opengl, and i found a tutorial and tryed to put that into a class. but i get the following error: error: argument of type `LRESULT (opengl::)(HWND__*, UINT, WPARAM, LPARAM)' does not match `LRESULT (*)(HWND__*, UINT, WPARAM, LPARAM)'| i dont know what this means or how i can fix it, i hope that someone is able to help me with this isue. greets roy,

Share this post

Link to post
Share on other sites
Original post by roy844
so i am trying to put a standalone function in a class member function ?

No, you're trying to pass a pointer to a member function to something expecting a pointer to a standalone function. You can't do it.

This really has nothing to do with OpenGL, as yet. You're dealing with window creation and handling, and trying to abstract that into a class, which is why I gave you the linked article. Basically, you need a regular function - and class static functions have the same signature as regular, standalone functions - which you pass to Windows, and then you store a pointer to the class instance as associated data. Each time Windows calls your regular function (a message routing function, essentially), it looks for the associated data in the window handle, converts that into a pointer to a class instance, and then calls your member function.

For a lengthier explanation, read the article. It's why I wrote it.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!