OpenGL prob

This is a discussion on OpenGL prob within the Game Programming forums, part of the General Programming Boards category; I'm trying to learn OpenGL, so I downloaded Lesson #1 from NeHe. When I run the program from MSVS .NET ...

  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,203
    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,203
    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,203
    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,203
    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
    Portugal
    Posts
    7,439
    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.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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

Page 1 of 2 12 LastLast
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-28-2005, 11:01 PM
  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, 06:57 PM
  5. FPS Counter Prob in OpenGL
    By brandonp in forum Game Programming
    Replies: 1
    Last Post: 07-16-2002, 02:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21