Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Linker Errors

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2009
    Posts
    10

    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

  2. #2
    Junior Member Regular Contributor
    Join Date
    Dec 2008
    Location
    USA
    Posts
    135

    Re: Linker Errors

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

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2009
    Posts
    10

    Re: Linker Errors

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

  4. #4
    Junior Member Newbie
    Join Date
    Aug 2009
    Posts
    10

    Re: Linker Errors

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

  5. #5
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,580

    Re: Linker Errors

    try with -lgl32

  6. #6
    Junior Member Newbie
    Join Date
    Aug 2009
    Posts
    10

    Re: Linker Errors

    It says it cannot find the -lgl32.

  7. #7
    Junior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    Latvia
    Posts
    225

    Re: Linker Errors

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

  8. #8
    Junior Member Newbie
    Join Date
    Aug 2009
    Posts
    10

    Re: Linker Errors

    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

  9. #9
    Junior Member Newbie
    Join Date
    Aug 2009
    Posts
    10

    Re: Linker Errors

    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
    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

  10. #10
    Junior Member Newbie
    Join Date
    Aug 2009
    Posts
    10

    Re: Linker Errors

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •