PDA

View Full Version : Linker Errors



EmmaculateBR
08-23-2009, 05:18 PM
I'm making a water model, and I have it all done, but I get what I think are linker errors. Here is what I get from the compiler:
Water.o(.text+0x2aa):Water.cpp: undefined reference to `_imp__glPolygonMode'
Water.o(.text+0x2b8):Water.cpp: undefined reference to `_imp__glEnable'
Water.o(.text+0x2d0):Water.cpp: undefined reference to `_imp__glPolygonMode'
Water.o(.text+0x2de):Water.cpp: undefined reference to `_imp__glDisable'

Water.o(.text+0x304):Water.cpp: undefined reference to `_imp__glEnable'
Water.o(.text+0x314):Water.cpp: undefined reference to `_imp__glDisable'
Water.o(.text+0x537):Water.cpp: undefined reference to `read_texture(char const*, int*, int*, int*)'
Water.o(.text+0x6fa):Water.cpp: undefined reference to `_imp__glPixelStorei'
Water.o(.text+0x719):Water.cpp: undefined reference to `_imp__glTexEnvf'
Water.o(.text+0x736):Water.cpp: undefined reference to `_imp__glTexEnvfv'
Water.o(.text+0x754):Water.cpp: undefined reference to `_imp__glTexParameteri'
Water.o(.text+0x772):Water.cpp: undefined reference to `_imp__glTexParameteri'
Water.o(.text+0x790):Water.cpp: undefined reference to `_imp__glTexParameteri'
Water.o(.text+0x7ae):Water.cpp: undefined reference to `_imp__glTexParameteri'
Water.o(.text+0x7f8):Water.cpp: undefined reference to `_imp__glTexImage2D'
Water.o(.text+0x806):Water.cpp: undefined reference to `_imp__glEnable'
Water.o(.text+0x814):Water.cpp: undefined reference to `_imp__glMatrixMode'
Water.o(.text+0x81b):Water.cpp: undefined reference to `_imp__glLoadIdentity'
Water.o(.text+0x84d):Water.cpp: undefined reference to `_imp__gluPerspective'
Water.o(.text+0x85b):Water.cpp: undefined reference to `_imp__glMatrixMode'
Water.o(.text+0x862):Water.cpp: undefined reference to `_imp__glLoadIdentity'
Water.o(.text+0x883):Water.cpp: undefined reference to `_imp__glTranslatef'
Water.o(.text+0x95e):Water.cpp: undefined reference to `_imp__glClearColor'
Water.o(.text+0x974):Water.cpp: undefined reference to `_imp__glFogi'
Water.o(.text+0x989):Water.cpp: undefined reference to `_imp__glFogf'
Water.o(.text+0x99e):Water.cpp: undefined reference to `_imp__glFogfv'
Water.o(.text+0x9bc):Water.cpp: undefined reference to `_imp__glEnable'
Water.o(.text+0x9cb):Water.cpp: undefined reference to `_imp__glLineWidth'
Water.o(.text+0x9d9):Water.cpp: undefined reference to `_imp__glEnable'
Water.o(.text+0x9ef):Water.cpp: undefined reference to `_imp__glBlendFunc'
Water.o(.text+0xa13):Water.cpp: undefined reference to `_imp__glBegin'
Water.o(.text+0xa2b):Water.cpp: undefined reference to `_imp__glTexCoord2f'
Water.o(.text+0xa4c):Water.cpp: undefined reference to `_imp__glVertex3f'
Water.o(.text+0xa64):Water.cpp: undefined reference to `_imp__glTexCoord2f'
Water.o(.text+0xa85):Water.cpp: undefined reference to `_imp__glVertex3f'
Water.o(.text+0xa9d):Water.cpp: undefined reference to `_imp__glTexCoord2f'
Water.o(.text+0xabe):Water.cpp: undefined reference to `_imp__glVertex3f'
Water.o(.text+0xad6):Water.cpp: undefined reference to `_imp__glTexCoord2f'
Water.o(.text+0xaf7):Water.cpp: undefined reference to `_imp__glVertex3f'
Water.o(.text+0xafe):Water.cpp: undefined reference to `_imp__glEnd'
Water.o(.text+0xb2a):Water.cpp: undefined reference to `_imp__glBegin'
Water.o(.text+0xbb9):Water.cpp: undefined reference to `_imp__glTexCoord2f'
Water.o(.text+0xbd4):Water.cpp: undefined reference to `_imp__glVertex3f'
Water.o(.text+0xc52):Water.cpp: undefined reference to `_imp__glTexCoord2f'
Water.o(.text+0xc6d):Water.cpp: undefined reference to `_imp__glVertex3f'
Water.o(.text+0xc90):Water.cpp: undefined reference to `_imp__glEnd'
Water.o(.text+0xcb0):Water.cpp: undefined reference to `_imp__glClear'

Water.o(.text+0xcb7):Water.cpp: undefined reference to `_imp__glPushMatrix'
Water.o(.text+0xcd8):Water.cpp: undefined reference to `_imp__glTranslatef'
Water.o(.text+0xd02):Water.cpp: undefined reference to `_imp__glRotatef'
Water.o(.text+0xd2c):Water.cpp: undefined reference to `_imp__glRotatef'
Water.o(.text+0xd4d):Water.cpp: undefined reference to `_imp__glScalef'
Water.o(.text+0xd77):Water.cpp: undefined reference to `_imp__glColor3f'
Water.o(.text+0xd98):Water.cpp: undefined reference to `_imp__glTranslatef'
Water.o(.text+0xda6):Water.cpp: undefined reference to `_imp__glMatrixMode'
Water.o(.text+0xdad):Water.cpp: undefined reference to `_imp__glPushMatrix'
Water.o(.text+0xdce):Water.cpp: undefined reference to `_imp__glTranslatef'
Water.o(.text+0xdef):Water.cpp: undefined reference to `_imp__glScalef'
Water.o(.text+0xdfb):Water.cpp: undefined reference to `_imp__glPopMatrix'
Water.o(.text+0xe09):Water.cpp: undefined reference to `_imp__glMatrixMode'
Water.o(.text+0xe10):Water.cpp: undefined reference to `_imp__glPopMatrix'
collect2: ld returned 1 exit status

make.exe: *** [Water.exe] Error 1


I use Dev-C++, on a Windows OS

todayman
08-23-2009, 06:23 PM
Did you link with an OpenGL library? If not, try adding -lGL to the linker options.

EmmaculateBR
08-24-2009, 01:16 PM
Yeah. In the linker box I have lglut32 lglu32 and a bunch of other ones all for OpenGL. I'll try that though.

EmmaculateBR
08-24-2009, 01:50 PM
Alright. I tried adding -lGL to the parameters, but then it says "Cannot find -lGL"

ZbuffeR
08-24-2009, 02:15 PM
try with -lgl32

EmmaculateBR
08-24-2009, 02:42 PM
It says it cannot find the -lgl32.
:p

martinsm
08-24-2009, 03:15 PM
If you are using MinGW compiler, then you should use -lopengl32 to link witn libopengl32.a library.

EmmaculateBR
08-24-2009, 04:11 PM
The whole list of my linker is this:
-lglut -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 -lopengl32 -lglut32 -GL
lib/libglu32.a
lib/libglut32.a
lib/libglut.a
lib/libopengl32.a


and still the same error as above

EmmaculateBR
08-24-2009, 07:53 PM
I got stumped with that project, and went on a new one, and now i have this error, which leads me to believe that my IDE is broken :p
Any help would be appreciated


Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
gcc.exe defrc.o matrix.o rc.o -o "RollerCoaster2.exe" -L"C:/Dev-Cpp/lib" -mwindows -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32

defrc.o(.text+0x5ca):defrc.c: undefined reference to `x'
defrc.o(.text+0x5dc):defrc.c: undefined reference to `y'
defrc.o(.text+0x5ee):defrc.c: undefined reference to `z'
defrc.o(.text+0x608):defrc.c: undefined reference to `al'
defrc.o(.text+0x622):defrc.c: undefined reference to `rl'
defrc.o(.text+0x63c):defrc.c: undefined reference to `hd'
defrc.o(.text+0x656):defrc.c: undefined reference to `pt'
defrc.o(.text+0x66e):defrc.c: undefined reference to `rl'
defrc.o(.text+0x675):defrc.c: undefined reference to `al'
defrc.o(.text+0x68b):defrc.c: undefined reference to `hd'
defrc.o(.text+0x6af):defrc.c: undefined reference to `pt'
defrc.o(.text+0x6ec):defrc.c: undefined reference to `opt'
defrc.o(.text+0x794):defrc.c: undefined reference to `dx'
defrc.o(.text+0x7ac):defrc.c: undefined reference to `dy'
defrc.o(.text+0x7c4):defrc.c: undefined reference to `dz'
defrc.o(.text+0x8a2):defrc.c: undefined reference to `strips'
defrc.o(.text+0x8ca):defrc.c: undefined reference to `strips'
defrc.o(.text+0x8f2):defrc.c: undefined reference to `strips'
defrc.o(.text+0x953):defrc.c: undefined reference to `normal'
defrc.o(.text+0x981):defrc.c: undefined reference to `normal'
defrc.o(.text+0x9af):defrc.c: undefined reference to `normal'
defrc.o(.text+0xa24):defrc.c: undefined reference to `bnormal'
defrc.o(.text+0xa45):defrc.c: undefined reference to `bnormal'
defrc.o(.text+0xa66):defrc.c: undefined reference to `bnormal'
defrc.o(.text+0xac3):defrc.c: undefined reference to `bnormal'
defrc.o(.text+0xae4):defrc.c: undefined reference to `bnormal'
defrc.o(.text+0xb05):defrc.c: more undefined references to `bnormal' follow
defrc.o(.text+0xb88):defrc.c: undefined reference to `r1'
defrc.o(.text+0xb9a):defrc.c: undefined reference to `r2'
defrc.o(.text+0xbac):defrc.c: undefined reference to `r3'

defrc.o(.text+0xbd3):defrc.c: undefined reference to `r1'
defrc.o(.text+0xbee):defrc.c: undefined reference to `r2'
defrc.o(.text+0xc13):defrc.c: undefined reference to `r3'
defrc.o(.text+0xc6b):defrc.c: undefined reference to `z'
defrc.o(.text+0xc7b):defrc.c: undefined reference to `y'
defrc.o(.text+0xc8b):defrc.c: undefined reference to `x'
C:/Dev-Cpp/lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16'
collect2: ld returned 1 exit status

make.exe: *** [RollerCoaster2.exe] Error 1

Execution terminated

EmmaculateBR
08-25-2009, 12:40 AM
Alright. I've got it down to one single error, but i am stuck.

undefined reference to `read_texture(char const*, int*, int*, int*)'


I've included the header file that has this function, but it still shows up :p
Any ideas?

EmmaculateBR
08-25-2009, 01:03 AM
Sorry for multiple postings, but I came across a new error while messing around with the linkers.
I run the program, everything seems to link fine, then a popup message comes up and says that the procedure entry point glRotatef could not be found in the OPENGL.dll file.
No clue what that means. :p

martinsm
08-25-2009, 01:18 AM
Why you shouldn’t use Dev-C++ (http://www.jasonbadams.net/20081218/why-you-shouldnt-use-dev-c/)

EmmaculateBR
08-25-2009, 04:02 PM
Well I can't get OpenGL set up with any other IDE. :p
Always get linker errors even though it's linked.

EmmaculateBR
08-25-2009, 05:19 PM
I set up Code:Blocks, and i get this error
Checking for existence: C:\Dev-Cpp\RollerCoaster.exe
Executing: "C:\Dev-Cpp\RollerCoaster.exe" (in C:\Dev-Cpp\.)
Process terminated with status 1 (0 minutes, 0 seconds)


:p
Any ideas?

ZbuffeR
08-26-2009, 05:02 AM
use the debugger and step through the code.