OpenGL: compiler showing error

  • Thread starter Mr Virtual
  • Start date
218
3

Main Question or Discussion Point

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
 

Answers and Replies

Vid
401
0
Try copying and pasting the code into a new workspace. That sometimes fixes linker errors.
 
218
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
 

Related Threads for: OpenGL: compiler showing error

  • Last Post
Replies
3
Views
9K
  • Last Post
Replies
4
Views
6K
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
9
Views
7K
Replies
1
Views
2K
Replies
10
Views
8K
  • Last Post
Replies
0
Views
1K
Replies
3
Views
9K
Top