Open GL. error undefined reference to `gluPerspective@32' Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
gintare
Knows some wx things
Knows some wx things
Posts: 33
Joined: Fri Feb 02, 2007 12:20 pm

Open GL. error undefined reference to `gluPerspective@32'

Post by gintare »

Hello,

I am having problems compiling the OpenGL tutorial found here:
http://wxdsgn.sourceforge.net/tutorials ... be76a9f.eg.
I just copied MyGLCanvas files from the tutorial to my application, included them in the project, frame header and created class in the constructor.
(I can not compile the whole example also. Error: cannot find -lwxmsw27 )

I am getting error:
[Linker Error] undefined reference to `gluPerspective@32'

In the MyGLCanvas.h i tried to change

Code: Select all

gluPerspective(45.0,((float)w /(float) h), 1.0, 1000.0);
//to
gluPerspective(45.0,((GLdouble)w /(GLdouble) h), 1.0, 1000.0);
but error persist.
According to glu.h the gluPersective is defined as:

Code: Select all

GLAPI void APIENTRY gluPerspective (GLdouble fovy,   GLdouble aspect,   GLdouble zNear,    GLdouble zFar);
where is my mistake?
Regards,
Gintare
swapd0
I live to help wx-kind
I live to help wx-kind
Posts: 169
Joined: Mon May 14, 2007 11:16 am
Location: Spain

Post by swapd0 »

A linker error means that the compiler found the function because you included it(#include "gl/glu,h"), but don't have it to include the code, only has the declaration.
To fix this you must include the library to the project, in this case glu32.lib
gintare
Knows some wx things
Knows some wx things
Posts: 33
Joined: Fri Feb 02, 2007 12:20 pm

Post by gintare »

now i am getting the error:

Code: Select all

cannot find -lwxmsw27   
ld returned 1 exit status 
 [Build Error] exe: *** [Default Profile/Project1.exe] Error 1


there is no glu32.lib, but there are other 4 libraries with similar names.
I tried several variants and formats like

Code: Select all

F:/Dev-Cpp/lib/libglu32.a
or

Code: Select all

-libglu32.a
The same with

Code: Select all

-libglaux.a
-libglut32.a
-libglut.a
what else could be done? In all cases the error is the same cannot find -lwxmsw27
regards,
Gintare
swapd0
I live to help wx-kind
I live to help wx-kind
Posts: 169
Joined: Mon May 14, 2007 11:16 am
Location: Spain

Post by swapd0 »

Have you tried to remove the -lwxmsw27 library, in my project I only use wxbase28d.lib from widgets, and i'm also doing some opengl stuff, ofcourse linked with opengl32.lib glu32.lib.
Post Reply