Thread: OpenGL prob

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    35

    OpenGL prob

    I'm trying to learn OpenGL, so I downloaded Lesson #1 from NeHe. When I run the program from MSVS .NET it returns 115 errors, I think it's the includes:

    Code:
    #include <windows.h>		
    #include <gl\gl.h>			
    #include <gl\glu.h>			
    #include <gl\glaux.h>
    Does anyone know what's going on?
    Last edited by HQSneaker; 08-10-2004 at 12:51 PM.

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Is it compiler errors or linker errors?? Can you post some of the errors you get? Dont forget to link with the correct libraries (opengl32.lib, glu32.lib glaux.lib). Post some more info (compiler and some errors) if this didnt help.
    Last edited by Shakti; 08-10-2004 at 01:20 PM.

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Quote Originally Posted by Shakti
    Also dont forget to link with the correct libraries (opengl32.lib, glu32.lib glaux.lib)
    this is the problem 90% of the time....

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    35
    Hmm.... I've put those libs in the solution-explorer, that should be enough, right? Still doesn't work, herre are some errors:

    Code:
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(60) : error C2143: syntax error : missing ';' before '*'
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(60) : error C2734: 'GLubyte' : const object must be initialized if not extern
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(61) : error C2065: 'GLenum' : undeclared identifier
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(61) : error C2146: syntax error : missing ')' before identifier 'errCode'
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(61) : warning C4229: anachronism used : modifiers on data are ignored
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(61) : error C2501: 'gluErrorString' : missing storage-class or type specifiers
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(61) : error C2059: syntax error : ')'
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(64) : error C2146: syntax error : missing ')' before identifier 'errCode'
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(64) : warning C4229: anachronism used : modifiers on data are ignored
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(64) : error C2059: syntax error : ')'
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(66) : error C2143: syntax error : missing ';' before '*'
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(66) : error C2734: 'GLubyte' : const object must be initialized if not extern
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(66) : error C2086: 'const int GLubyte' : redefinition
            c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(60) : see declaration of 'GLubyte'
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(67) : error C2146: syntax error : missing ')' before identifier 'name'
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(67) : warning C4229: anachronism used : modifiers on data are ignored
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(67) : error C2501: 'gluGetString' : missing storage-class or type specifiers
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(67) : error C2059: syntax error : ')'
    c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\gl\GLU.h(70) : error C2065: 'GLdouble' : undeclared identifier

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    You shouldnt put them in solutions explorer, do like this:

    1: Rightclick on your project in solutions explorer.
    2: Choose properties.
    3: Click on linker to expand it.
    4: Click on command line.
    5: In the little box at the bottom where it says Additional options write this: opengl32.lib glu32.lib glaux.lib

    If you have done all this already I have no idea why it isnt working.

  6. #6
    Registered User
    Join Date
    Jul 2004
    Posts
    35
    Ok, so what exactly do I type? 'Cause this:

    Code:
    opengl32.lib glu32.lib glaux.lib
    doesn't work

  7. #7
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    What do you mean doesnt work? It doesnt take the errors away or do you get other errors? And that IS exactly what you type, make sure you do exactly like it says.

  8. #8
    Registered User
    Join Date
    Jul 2004
    Posts
    35
    I asked because there already is something in the Additional options-box:

    Code:
    /MACHINE:I386
    Also, this code is downloaded and I've got an .exe of it too. Shouldn't the developers have included this as well?

    Still the same errors

  9. #9
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Quote Originally Posted by HQSneaker
    Ok, so what exactly do I type? 'Cause this:

    Code:
    opengl32.lib glu32.lib glaux.lib
    doesn't work
    try make those 3 libs the first 3 on the command line

  10. #10
    Registered User
    Join Date
    Jul 2004
    Posts
    35
    The entire sentence:

    Code:
    /MACHINE:I386 opengl.lib glu32.lib glaux.lib kernel32.lib
    Anything I forgot, ´cause it sure looks like it

  11. #11
    Registered User
    Join Date
    Jul 2004
    Posts
    35
    Wait.... As you can see, the errors come from the header files..

  12. #12
    Registered User
    Join Date
    Jun 2006
    Posts
    4

    Please help, header errors!!

    H,i my name is Danny and I am having the same header errors. I put the appropriate lib files in the linker yet I am still having the errors. Please help!!!!

  13. #13
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Ehem, just so you know in the future; dont bump old old old old old threads.

    Now just because i feel happy today ill present a possible solution: include windows.h before you include anything related to opengl.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  14. #14
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    dunno... it shows he actually did a search for the subject before posting. I commend him. Many who ask about cin.get(), to name one, don't.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  15. #15
    Registered User
    Join Date
    Jun 2006
    Posts
    4
    thanks for the advice and sorry about that. I have window.h as the first header file. The errors are still here though. Does anyone else have a suggestion or any websites I can browse?

    Thanks
    Danny

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  2. nehe opengl prob
    By bluehead in forum C++ Programming
    Replies: 6
    Last Post: 03-29-2005, 12:01 AM
  3. Mouse 'control' prob in OpenGL
    By gazsux in forum Game Programming
    Replies: 5
    Last Post: 04-17-2003, 10:00 AM
  4. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM
  5. FPS Counter Prob in OpenGL
    By brandonp in forum Game Programming
    Replies: 1
    Last Post: 07-16-2002, 02:49 PM