Thread: gl beginners' trouble

  1. #1
    GA ichijoji's Avatar
    Join Date
    Nov 2002
    Posts
    179

    gl beginners' trouble

    Ok, so I got a book (OpenGL Game Programming), and I tried to compile the first example (attached) on both dev-cpp and msvc, but here's what I got on both tries:
    Linking...
    Learn Opengl!.obj : error LNK2001: unresolved external symbol _gluPerspective@32
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__glEnd@0
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__glVertex3f@12
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__glBegin@4
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__glColor3f@12
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__glRotatef@16
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__glTranslatef@12
    Learn Opengl!.obj : error LNK2001: unresolved external symbol __imp__glClear@4
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/Learn Opengl!.exe : fatal error LNK1120: 15 unresolved externals
    Error executing link.exe.
    Is there a library or something that I need to worry about like with allegro or what? What am I doing wrong?
    Illusion and reality become impartiality and confidence.

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Did you include the directory with the include files in the path where your compiler is looking for them?

    If you did...which you probably didn't...so check it again...try #include <glut.h> I'm not an OpenGL programmer, but I've seen that library mentioned many times.
    Away.

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    in msvc++ go to 'project' then 'settings' then click on the 'Link' tab and put this line in before Kernel32.lib

    OpenGL32.lib GLu32.lib GLaux.lib

  4. #4
    GA ichijoji's Avatar
    Join Date
    Nov 2002
    Posts
    179
    I knew it was some library, stupid book. But...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    I linked OpenGL32.lib, GLu32.lib, and GLaux.lib, but I still get this one stubborn error, thanks for all your help!
    Last edited by ichijoji; 06-11-2003 at 01:18 PM.
    Illusion and reality become impartiality and confidence.

  5. #5
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    perhaps you need to change main() to winmain()?
    Away.

  6. #6
    Cool, u like cowboy bebop too? I love that show.

  7. #7
    GA ichijoji's Avatar
    Join Date
    Nov 2002
    Posts
    179
    It's winmain just like its supposed to be, has anyone seen anything like this before, how can I make it compile???
    Illusion and reality become impartiality and confidence.

  8. #8
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    Posts
    537
    is it a win32 project or a console project? Sounds like you need to use whichever one you haven't chosen
    Couldn't think of anything interesting, cool or funny - sorry.

  9. #9
    GA ichijoji's Avatar
    Join Date
    Nov 2002
    Posts
    179
    *smacks head* I just knew it was something stupid like that... thx guys
    -D
    Illusion and reality become impartiality and confidence.

  10. #10
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    when it says that it can't find main, that means it's looking for the "main" function that you'd usually use in dos programs or whatever. For OpenGL and proggies that run through win32, you need to have it be a "Win32 Application" NOT console app. Just keep that in mind next time you make a project

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. for beginner's or anyone interested
    By Iconoklast in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 03-25-2004, 02:45 PM
  2. open gl
    By nerdyneo in forum Game Programming
    Replies: 2
    Last Post: 11-14-2003, 04:33 PM
  3. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM
  4. gl, glu, glaux, glut
    By vasanth in forum Game Programming
    Replies: 5
    Last Post: 07-13-2003, 10:34 PM
  5. Dx, Sdl, Open-gl
    By dayknight in forum Game Programming
    Replies: 26
    Last Post: 12-28-2002, 02:17 PM