Jump to content
  • Advertisement
Sign in to follow this  
3dmodelerguy

unsigned long error?

This topic is 4972 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 now have this problem: her is my GLCanvas code: GLCanvas( wxWindow *frame, int &var, wxPoint &point, wxSize &size, DWORD &style, wxString &title ) and here is how i use it: GLCanvas *MainGLWindow = new GLCanvas( GameWindow, Default_Window_Value, wxPoint( 0, 0 ), wxSize( 800, 600 ), wxNO_BORDER, NULL); and this error: C:\Stromgage 3D Game Engine\Stromgage 3D Game Engine\MainApp.cpp(17) : error C2664: 'GLCanvas::GLCanvas' : cannot convert parameter 5 from 'enum wxBorder' to 'unsigned long &' i thought DWORD was long?

Share this post


Link to post
Share on other sites
Advertisement
The function prototype includes a '&' which means that it requires a variable, rather than a constant. i.e. something that it can take the address of.

So, do this:
DWORD style = wxNO_BORDER;
wxString title = "";
GLCanvas *MainGLWindow = new GLCanvas( GameWindow, Default_Window_Value, wxPoint( 0, 0 ), wxSize( 800, 600 ), style, title);

Parameter 5 is like this because that parameter is probably an in/out parameter meaning that you need to supply a variable to hold the resulting value, as it could differ from what you supplied.
Parameter 6 also has a problem the way you are using it because you can't pass NULL to an & parameter again. Thought in this case the & is because it is more efficient to pass by reference than by value. (The definition should probably have it as const I suspect).

Share this post


Link to post
Share on other sites
Also DWORD is not a long its an unsigned long.

I've seen plenty of bugs caused by funcitons that look like this

DWORD MyMethod()

if( MyMethod == -1 )

Since its unsigned the only way you'll get this case is by compiler promotion and dumb luck:)

Cheers
Chris

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!