Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Linker cannot find opengl libraries :(

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2005
    Posts
    5

    Linker cannot find opengl libraries :(

    Hey guys, I've been trying to setup opengl on my computer for the last few days. I've been searching these forums like crazy and it has been incredibly helpful, so thanks to everyone for their good responses in the past.

    Currently, i'm trying to run a simple file to draw some shapes that the graphics teacher at my school gave me. The includes look like this:

    #include <stdio.h>
    #include <GL/gl.h>
    #include <GL/glu.h>
    #include <GL/glut.h>

    The project uses a main, so it IS a win32 console application. When running the project it gives the error:

    Linking...
    LINK : fatal error LNK1104: cannot open file "opengl32.lib"
    Error executing link.exe.

    The files are correctly linked into the project through the settings, and C:\Program Files\Microsoft Visual Studio\VC98\Lib\gl directory contains opengl32.lib glut32.lib and glu32.lib. I tried moving the opengl32.lib file out of the gl directory (heh couldn't think of anything else to tinker with) and I got the same error except for the glut32.lib file rather than the opengl32.lib file.

    I haven't found a good solution in the forums. Any similar problems were solved by linking the files correctly in VC or by putting the .lib files in the correct directory.

    I suppose I could just have bad .lib files, but I'm not particularly sure where to get better ones. Any help is greatly appreciated. Thanks guys!
    -Mark

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    mexico
    Posts
    125

    Re: Linker cannot find opengl libraries :(

    hi, my glu32.lib glaux.lib and opengl32.lib are on C:\Program Files\Microsoft Visual Studio\VC98\Lib. you say yours are on a gl folder i never seen a folder inside the lib folder

  3. #3
    Member Contributor
    Join Date
    Jan 2005
    Location
    Karachi, Pakistan
    Posts
    85

    Re: Linker cannot find opengl libraries :(

    HEllo there,
    For the linker errors make sure that the paths to folder to the opengl headers and lib are set in your compiler have a look t compiler docs for help on this. As for opengl32.lib it comes with the opengl sdk for the platform so if you have installed the sdk correctly opengl32.lib would be present in your system.

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2005
    Posts
    5

    Re: Linker cannot find opengl libraries :(

    Heh, yea... The gl directory is for the headers, not libraries. I got a bit confused there. I'm back to getting a bunch of link errors:

    Linking...
    i.obj : error LNK2001: unresolved external symbol _glFlush
    i.obj : error LNK2001: unresolved external symbol _glEnd
    i.obj : error LNK2001: unresolved external symbol _glVertex2d
    i.obj : error LNK2001: unresolved external symbol _glBegin
    i.obj : error LNK2001: unresolved external symbol _glColor3d
    i.obj : error LNK2001: unresolved external symbol _glClear
    i.obj : error LNK2001: unresolved external symbol _gluErrorString
    i.obj : error LNK2001: unresolved external symbol _glGetError
    i.obj : error LNK2001: unresolved external symbol _gluOrtho2D
    i.obj : error LNK2001: unresolved external symbol _glLoadIdentity
    i.obj : error LNK2001: unresolved external symbol _glMatrixMode
    i.obj : error LNK2001: unresolved external symbol _glLineWidth
    i.obj : error LNK2001: unresolved external symbol _glClearColor
    Debug/TestProject.exe : fatal error LNK1120: 13 unresolved externals
    Error executing link.exe.

    I checked yet again just to make SURE i had added the opengl32.lib, glut32.lib and glu32.lib to the link settings of the project. All the files that I need are now in their appropriate places. Any ideas what could be causeing those linking errors?

    Oh and I did set the paths to the lib files and headers in the compiler but it still is throwing the link errors now .

    Thanks again guys!
    -Mark

  5. #5
    Junior Member Newbie
    Join Date
    Feb 2005
    Location
    Mexico
    Posts
    9

    Re: Linker cannot find opengl libraries :(

    1. Click on Project and then Settings
    2. Select the "Link" tag
    3. Include the following libraries before Kernel32.lib
    OpenGL32.lib GLu32.lib GLaux.lib
    4. Click Ok

    That will include libraries into your project
    Regards,
    Jorge Castilleja
    jorge_castilleja@yahoo.com

  6. #6
    Senior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    mexico
    Posts
    125

    Re: Linker cannot find opengl libraries :(

    try linking them at compile time using:
    Code :
    #pragma commment(lib,"opengl32.lib")

  7. #7
    Junior Member Newbie
    Join Date
    Feb 2005
    Posts
    5

    Re: Linker cannot find opengl libraries :(

    The libraries are all linked in the settings. I tried loading all 3 at compile time as per the pragma command shown, however it still gives the link errors along with warnings:

    c:\program files\microsoft visual studio\myprojects\testproject\source files\i.cpp(13) : warning C4068: unknown pragma
    c:\program files\microsoft visual studio\myprojects\testproject\source files\i.cpp(14) : warning C4068: unknown pragma
    c:\program files\microsoft visual studio\myprojects\testproject\source files\i.cpp(15) : warning C4068: unknown pragma

    Those warnings may be becase I also left the lib files as linked in the settings. When running without the links set in VC++ settings and the pragma comments inserted, I continue to get the same linking errors as before .
    -Mark

  8. #8
    Senior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    mexico
    Posts
    125

    Re: Linker cannot find opengl libraries :(

    can you send me your code, so i can check it?

  9. #9
    Junior Member Newbie
    Join Date
    Feb 2005
    Posts
    5

    Re: Linker cannot find opengl libraries :(

    My thanks to Zukko for looking over the code to make sure everything looked good. We found a few things to fix, however the linking errors are still showing up.

    I tried something new today also. I figured maybe the lib files I got from microsoft were bad. Everywhere I read said that winXP should already have the opengl32.dll and the glu32.dll files, but my system directory didn't have them. I downloaded the ones for windows 95 from microsoft. Today I noticed I did have those DLL's in the system32 folder, so I copied them over to the system folder, but I still get those same link errors. Then off the small chance that the stuff I had been reading was wrong, I copied glut32.dll to the system32 folder, just in case that was where my project was trying to grab its .dll files. That didn't work either .

    Any other thoughts? Any recommended windows compilers I should try using instead of VC 6.0? Maybe I can get a different compiler working?

    EDIT: One more edit hehe. I got the files to link in borland but I am still getting the same link errors!

    FINAL EDIT: Haha and I said that the first two edits would be enough. I got my code to compile! It isn't listed in the main setup instructions, but in the faq it mentions that you must #include the windows.h header file since the gl, glu, glut header files make use of it. I added the include and it compiled with no link errors!!

    Thanks everyone so much for your help!
    -Mark

  10. #10
    Senior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    mexico
    Posts
    125

    Re: Linker cannot find opengl libraries :(

    i fixed your code! check the private msg for the link

Page 1 of 2 12 LastLast

Similar Threads

  1. Can't find layer libraries on Linux
    By jesta88 in forum Vulkan
    Replies: 2
    Last Post: 03-27-2018, 10:22 AM
  2. Where can I find the OpenGL libraries?
    By JasonKoller in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-23-2011, 11:34 AM
  3. what is opengl1.4??? why is it so damn difficult to find opengl libraries?
    By opengl_enquirer in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 10-02-2003, 08:09 AM
  4. Replies: 2
    Last Post: 01-10-2002, 01:01 PM
  5. Replies: 1
    Last Post: 03-02-2001, 04:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean