• Advertisement

Archived

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

I cant find the problem!Aargh!(Visual C++)

This topic is 5595 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 just finnished going through Tutorial 1 of openGL of the nehe.gamedev.net and programmed it as I went along. Now there are two errors I cant get away and I get extremely frustrated, I am going out of my mind. Here is the piece that im struggeling with... ------------------------------------------------- if(!UnregisterClass("OpenGLWindow",hInstance)) unable to register the Class. { MessageBox(NULL,"Could not unregister class.","SHUTDOWN ERROR",MB_OK|MB_ICONINFORMATION); hInstance=NULL; } } **BOOL OpenGL Window(char* title, int width, int height, int bits, bool fullscreenflag); { GLuint PixelFormat; WNDCLASS wc; DWORD dwExStyle; DWORD dwStyle; Sorry that the code is so messy, I had to try and fit it in here. :o) The first error is... -------------------------------------------------- C:\Program Files\Microsoft Visual Studio\MyProjects\OpenGLWindow\Main.cpp(83) : error C2146: syntax error : missing '';'' before identifier ''Window'' -------------------------------------------------- The second one is... -------------------------------------------------- C:\Program Files\Microsoft Visual Studio\MyProjects\OpenGLWindow\Main.cpp(83) : fatal error C1004: unexpected end of file found -------------------------------------------------- There errors accure by the two stars next to BOOL. I am realy clueless here, and dont know what to do?!? Remember that it was from lesson01,''Creating a GL window''. Maybe someone could tell me the problem, or give me something to check? Ill be realy greatfull!

Share this post


Link to post
Share on other sites
Advertisement
Firstly im not used to OpenGL but even so i can see a few mistakes in your code.

The first error is caused as your line

BOOL OpenGL Window(char* title, int width, int height, int bits, bool fullscreenflag);

has a ; at the end of the function. This is wrong unless you are delaring the function header (i.e. saying the function exists in your program).

OK the code should look more like this:


if(!UnregisterClass("OpenGLWindow",hInstance)) //unable to register the Class.
{
MessageBox(NULL,"Could not unregister class.","SHUTDOWN ERROR",MB_OK|MB_ICONINFORMATION);
hInstance=NULL;
}

BOOL OpenGL Window(char* title, int width, int height, int bits, bool fullscreenflag)
{
GLuint PixelFormat; WNDCLASS wc; DWORD dwExStyle; DWORD dwStyle;
//....more code
}


I'm not sure about the OpenGL statement in what appears to be the window creation function. This may or may not be required, check the API documentation...

Hope that helps a bit,

Ant
>





[edited by - antuk on December 1, 2002 10:11:52 AM]

[edited by - antuk on December 1, 2002 10:12:30 AM]

Share this post


Link to post
Share on other sites
remove the space betweeen OpenGL and Window -->
BOOL OpenGLWindow (char* title, int width, int height, int bits, bool fullscreenflag)

[edit]:
and remove those two stars


[edited by - veal on December 1, 2002 6:14:45 PM]

Share this post


Link to post
Share on other sites
You should see the FAQ section of this site to learn
how to put the code in an apropriate window...

To put the code in an apropriate window write:

[ source]
// Your
// Code
// Here
[ /source]

without the space after the '[' character.

Kamikaze

[edited by - Kamikaze15 on December 1, 2002 11:01:00 PM]

Share this post


Link to post
Share on other sites
copied and pasted from the tutorial you mentioned...


  

if (!UnregisterClass("OpenGL",hInstance)) // Are We Able To Unregister Class

{
MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hInstance=NULL; // Set hInstance To NULL

}
}

BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag)
{

...




hmmm what are those two asterixes for???

Share this post


Link to post
Share on other sites

  • Advertisement