Linker Errors

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

Did you link with an OpenGL library? If not, try adding -lGL to the linker options.

Yeah. In the linker box I have lglut32 lglu32 and a bunch of other ones all for OpenGL. I’ll try that though.

Alright. I tried adding -lGL to the parameters, but then it says “Cannot find -lGL”

try with -lgl32

It says it cannot find the -lgl32.
:stuck_out_tongue:

If you are using MinGW compiler, then you should use -lopengl32 to link witn libopengl32.a library.

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

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 :stuck_out_tongue:
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 toy’
defrc.o(.text+0x5ee):defrc.c: undefined reference to z' defrc.o(.text+0x608):defrc.c: undefined reference toal’
defrc.o(.text+0x622):defrc.c: undefined reference to rl' defrc.o(.text+0x63c):defrc.c: undefined reference tohd’
defrc.o(.text+0x656):defrc.c: undefined reference to pt' defrc.o(.text+0x66e):defrc.c: undefined reference torl’
defrc.o(.text+0x675):defrc.c: undefined reference to al' defrc.o(.text+0x68b):defrc.c: undefined reference tohd’
defrc.o(.text+0x6af):defrc.c: undefined reference to pt' defrc.o(.text+0x6ec):defrc.c: undefined reference toopt’
defrc.o(.text+0x794):defrc.c: undefined reference to dx' defrc.o(.text+0x7ac):defrc.c: undefined reference tody’
defrc.o(.text+0x7c4):defrc.c: undefined reference to dz' defrc.o(.text+0x8a2):defrc.c: undefined reference tostrips’
defrc.o(.text+0x8ca):defrc.c: undefined reference to strips' defrc.o(.text+0x8f2):defrc.c: undefined reference tostrips’
defrc.o(.text+0x953):defrc.c: undefined reference to normal' defrc.o(.text+0x981):defrc.c: undefined reference tonormal’
defrc.o(.text+0x9af):defrc.c: undefined reference to normal' defrc.o(.text+0xa24):defrc.c: undefined reference tobnormal’
defrc.o(.text+0xa45):defrc.c: undefined reference to bnormal' defrc.o(.text+0xa66):defrc.c: undefined reference tobnormal’
defrc.o(.text+0xac3):defrc.c: undefined reference to bnormal' defrc.o(.text+0xae4):defrc.c: undefined reference tobnormal’
defrc.o(.text+0xb05):defrc.c: more undefined references to bnormal' follow defrc.o(.text+0xb88):defrc.c: undefined reference tor1’
defrc.o(.text+0xb9a):defrc.c: undefined reference to r2' defrc.o(.text+0xbac):defrc.c: undefined reference tor3’

defrc.o(.text+0xbd3):defrc.c: undefined reference to r1' defrc.o(.text+0xbee):defrc.c: undefined reference tor2’
defrc.o(.text+0xc13):defrc.c: undefined reference to r3' defrc.o(.text+0xc6b):defrc.c: undefined reference toz’
defrc.o(.text+0xc7b):defrc.c: undefined reference to y' defrc.o(.text+0xc8b):defrc.c: undefined reference tox’
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

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 :stuck_out_tongue:
Any ideas?

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. :stuck_out_tongue:

Why you shouldn’t use Dev-C++

Well I can’t get OpenGL set up with any other IDE. :stuck_out_tongue:
Always get linker errors even though it’s linked.

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)

:stuck_out_tongue:
Any ideas?

use the debugger and step through the code.