View Full Version : [Linker error] Undefined reference to 'gl***'
Anklebiter
06-19-2004, 04:00 AM
There seems to be problem with linkin my program during the compilation.
make.exe -f "C:\Documents and Settings\Ketil\My Documents\Programmering\C++\OpenGLTest\Makefile.wi n" all
g++.exe main.o -o "OpenGLTest.exe" -L"C:/Dev-Cpp/lib"
This is what Dev-C++ 4.9.8.0 writes during the compilation. I've includet gl.h and glu.h. OpenGL32.lib, OpenGL.lib and glu32.lib is in my lib folder. (C:/Dev-Cpp/lib).
I recieve this:
main.o(.text+0x1b):main.cpp: undefined reference to `glViewport@16'
and alot more of them (35 to be exact!)
What may be the problem?
ce110ut
06-19-2004, 07:23 AM
append to your make statement this:
-lOpenGL32 -lGlu32
[those are lowercase L's]
:regards:
Originally posted by Anklebiter:
There seems to be problem with linkin my program during the compilation.
make.exe -f "C:\Documents and Settings\Ketil\My Documents\Programmering\C++\OpenGLTest\Makefile.wi n" all
g++.exe main.o -o "OpenGLTest.exe" -L"C:/Dev-Cpp/lib"
This is what Dev-C++ 4.9.8.0 writes during the compilation. I've includet gl.h and glu.h. OpenGL32.lib, OpenGL.lib and glu32.lib is in my lib folder. (C:/Dev-Cpp/lib).
I recieve this:
main.o(.text+0x1b):main.cpp: undefined reference to `glViewport@16'
and alot more of them (35 to be exact!)
What may be the problem?
Anklebiter
06-20-2004, 12:12 PM
Thanks. But I still recieve 3 more errors...
main.o(.text+0x6fd):main.cpp: undefined reference to `ChoosePixelFormat@8'
main.o(.text+0x72e):main.cpp: undefined reference to `SetPixelFormat@12'
main.o(.text+0xc43):main.cpp: undefined reference to `SwapBuffers@4'
All these should be in the OpenGl32 library, so therefor I can't understand why I recieve them...
harsman
06-20-2004, 02:25 PM
Those are windows functions, try -lwin32 or something similar, I don't know the switch for the Windows gcc port offhand, as I haven't used that compiler for quite some time. Should be in the documentation somewhere though.
I have had the same problem... Try using this linker line:
-lopengl32 -lglaux -lglu32 -lglut32 -gdi32 -mwindows
That basically covers most of the Things used in opengl other that -lglut32...
Also try adding the wingdi.h to your header, I think that is what it is called...
BTW, Are you following a tutorial or a book or anything like that?
Also try reading this topic: http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_to pic;f=2;t=016637 (http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=2;t=016637)
For those of you that are still interrested... in Dev-CPP under the lib directory there is a library called libgdi32.a
Linking to this library should cure the linker errors for SwapBuffers, ChosePixelFormat, and SetPixelFormat.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.