C/C++ Why Does My OpenGL Code Show a Linker Error in Dev C++?

  • Thread starter Thread starter Mr Virtual
  • Start date Start date
  • Tags Tags
    Compiler Error
AI Thread Summary
The discussion centers around a linker error encountered while compiling OpenGL code using Dev C++ version 4.9.9.2, specifically the "undefined reference to `gluPerspective@32'" error. The user initially attempted to resolve the issue by copying the code into a new workspace, but this did not work. The solution was found by identifying that the linker was missing the necessary file "-lglu32." To fix similar issues, it is recommended to check the linker settings in the project options and ensure that the required libraries, specifically -lopengl32, -lglaux32, and -lglu32, are included. After adding these files, the program compiled and ran successfully.
Mr Virtual
Messages
218
Reaction score
4
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
 
Technology news on Phys.org
Try copying and pasting the code into a new workspace. That sometimes fixes linker errors.
 
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
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
I am trying to run an .ipynb file and have installed Miniconda as well as created an environment as such -conda create -n <env_name> python=3.7 ipykernel jupyter I am assuming this is successful as I can activate this environment via the anaconda prompt and following command -conda activate <env_name> Then I downloaded and installed VS code and I am trying to edit an .ipynb file. I want to select a kernel, via VS Code but when I press the button on the upper right corner I am greeted...

Similar threads

Replies
22
Views
3K
Replies
39
Views
4K
Replies
1
Views
9K
Replies
4
Views
4K
Replies
3
Views
5K
Replies
2
Views
2K
Back
Top