Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

OpenGL: compiler showing error

  1. Apr 11, 2008 #1
    I am using Dev C++ compiler version 4.9.9.2
    When I compiled my OpenGL code, the compiler gave the following error:

    [Linker error] undefined reference to `gluPerspective@32'
    ld returned 1 exit status
    [Build Error] [Project1.exe] Error 1

    I am taking NeHe tutorials, where a function gluPerspective() has been used. When I compiled the same code sometime back, it worked perfectly. Any idea what this error is and how to tackle it?

    regards
    Mr V
     
  2. jcsd
  3. Apr 11, 2008 #2

    Vid

    User Avatar

    Try copying and pasting the code into a new workspace. That sometimes fixes linker errors.
     
  4. Apr 11, 2008 #3
    I tried this but nothing happened. Never mind because I found out what was causing the error: the linker section of the project had a file called -lglu32 missing. On includeing this file, the program ran perfectly.

    For anybody who faces a similar problem in OpenGL and is using Dev C++:
    1. Go to 'Project' and click on 'Project Options'.
    2. In the dialog box that opens, click on 'Parameters'. You will see the dialog box divided into three parts: Compiler, C++ Compiler, Linker. Your job is to check that the linker category contains all the three files: -lopengl32 -lglaux32 -lglu32, written in any order. Click OK, and try to recompile and run the program. It should work fine now.

    regards
    Mr V
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: OpenGL: compiler showing error
Loading...