7 Replies - 7201 Views - Last Post: 14 November 2012 - 03:42 PM Rate Topic: -----

#1 dragonx99  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-August 11

Linker Error while using GLM for loading model in OpenGL

Posted 08 August 2011 - 02:44 AM

I'm trying to load a simple cube in obj format in OpenGL using the GLM library for loading models. However inlcuding glm.h or keeping both glm.cpp and glm.h within the same directory as the project itself makes no difference. I'm getting the same linker error. I'm using MinGW on Windows XP.
In Linker Options I've inserted this: -lopengl32 -lglu32 -lglut32 -lglaux -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32
Here's the error as displayed in the Compile Log of DevC++:

Building Makefile: "C:\Development\Dev-Cpp\workspace\OpenGL_LoadingModels\Makefile.win"
Executing make...
make.exe -f "C:\Development\Dev-Cpp\workspace\OpenGL_LoadingModels\Makefile.win" all
g++.exe main.o -o "OpenGL_LoadingModels.exe" -L"C:/mingw/lib/" -L"C:/mingw/lib32/" -L"C:/SDL-1.2.14/lib" -lopengl32 -lglu32 -lglut32 -lglaux -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32
main.o:main.cpp:(.text+0x2b4): undefined reference to `glmDraw(_GLMmodel*, unsigned int)'
main.o:main.cpp:(.text+0x41d): undefined reference to `glmList(_GLMmodel*, unsigned int)'

main.o:main.cpp:(.text+0x436): undefined reference to `glmReadOBJ(char*)'
main.o:main.cpp:(.text+0x448): undefined reference to `glmUnitize(_GLMmodel*)'
main.o:main.cpp:(.text+0x45b): undefined reference to `glmFacetNormals(_GLMmodel*)'

main.o:main.cpp:(.text+0x472): undefined reference to `glmVertexNormals(_GLMmodel*, float)'
collect2: ld returned 1 exit status

make.exe: *** [OpenGL_LoadingModels.exe] Error 1
Execution terminated


Is This A Good Question/Topic? 0
  • +

Replies To: Linker Error while using GLM for loading model in OpenGL

#2 jimblumberg  Icon User is offline

  • member icon


Reputation: 4100
  • View blog
  • Posts: 12,695
  • Joined: 25-December 09

Re: Linker Error while using GLM for loading model in OpenGL

Posted 08 August 2011 - 07:18 AM

It looks like you missed a library, maybe glm?

Jim
Was This Post Helpful? 0
  • +
  • -

#3 dragonx99  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-August 11

Re: Linker Error while using GLM for loading model in OpenGL

Posted 08 August 2011 - 08:32 PM

View Postjimblumberg, on 08 August 2011 - 07:18 AM, said:

It looks like you missed a library, maybe glm?


I believe its a header only library because no where is it mentioned in the site from where I've downloaded the necessity of a library file along with the header files and cpp files already provided.

http://www.eden.net....0031008glm.html

http://devernay.free.fr/hacks/glm/
Was This Post Helpful? 0
  • +
  • -

#4 Coding in the name of  Icon User is offline

  • D.I.C Head

Reputation: 67
  • View blog
  • Posts: 232
  • Joined: 07-July 10

Re: Linker Error while using GLM for loading model in OpenGL

Posted 08 August 2011 - 08:36 PM

The linker errors are about missing glm functions. From your first link there are three c files you need to compile. I looked in the zip download from the first link and the c files are there.
Was This Post Helpful? 0
  • +
  • -

#5 dragonx99  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-August 11

Re: Linker Error while using GLM for loading model in OpenGL

Posted 08 August 2011 - 08:57 PM

Here is the site from which I had downloaded the glm files. Sorry for posting the wrong sites. I got confused as to where from I had downloaded the glm.zip file. So I have to place all the cpp files and the header files in the project directory and compile them too, right?

http://www.3dcodingt...etting-GLM.html
Was This Post Helpful? 0
  • +
  • -

#6 dragonx99  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-August 11

Re: Linker Error while using GLM for loading model in OpenGL

Posted 08 August 2011 - 09:08 PM

Now I get a whole bunch of linker errors. GLM depends on GLUT, which is present in my include directory under GL. Possibly compiler cannot link to OpenGL functions now.

Is it because of the ordering of libraries, which in my case is given as below?
-lopengl32 -lglu32 -lglut32 -lglaux -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32

These are the errors thrown:

Building Makefile: "C:\Development\Dev-Cpp\workspace\OpenGL_LoadingModels\Makefile.win"
Executing make...
make.exe -f "C:\Development\Dev-Cpp\workspace\OpenGL_LoadingModels\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/mingw/include/" -I"C:/mingw/i686-w64-mingw32/include/" -I"C:/SDL-1.2.14/include" -Wno-write-strings
g++.exe -c glm.cpp -o glm.o -I"C:/mingw/include/" -I"C:/mingw/i686-w64-mingw32/include/" -I"C:/SDL-1.2.14/include" -Wno-write-strings
g++.exe -c glmimg.cpp -o glmimg.o -I"C:/mingw/include/" -I"C:/mingw/i686-w64-mingw32/include/" -I"C:/SDL-1.2.14/include" -Wno-write-strings
g++.exe -c Texture.cpp -o Texture.o -I"C:/mingw/include/" -I"C:/mingw/i686-w64-mingw32/include/" -I"C:/SDL-1.2.14/include" -Wno-write-strings
g++.exe main.o glm.o glmimg.o Texture.o -o "OpenGL_LoadingModels.exe" -L"C:/mingw/lib/" -L"C:/mingw/lib32/" -L"C:/SDL-1.2.14/lib" -lopengl32 -lglu32 -lglut32 -lglaux -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32
Warning: resolving __imp____glutInitWithExit by linking to __imp____glutInitWithExit@12
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
Warning: resolving __imp____glutCreateWindowWithExit by linking to __imp____glutCreateWindowWithExit@8
Warning: resolving __imp____glutCreateMenuWithExit by linking to __imp____glutCreateMenuWithExit@8
Warning: resolving __imp__glEnable by linking to __imp__glEnable@4
Warning: resolving __imp__glMaterialfv by linking to __imp__glMaterialfv@12
Warning: resolving __imp__glMaterialf by linking to __imp__glMaterialf@12
Warning: resolving __imp__glBindTexture by linking to __imp__glBindTexture@8
Warning: resolving __imp__glBegin by linking to __imp__glBegin@4
Warning: resolving __imp__glEnd by linking to __imp__glEnd@0
glm.o:glm.cpp:(.text+0x4ab7): undefined reference to `_imp__glDeleteTextures'
glm.o:glm.cpp:(.text+0x5e0c): undefined reference to `_imp__glDisable'
glm.o:glm.cpp:(.text+0x5e43): undefined reference to `_imp__glTexEnvf'
glm.o:glm.cpp:(.text+0x5fbf): undefined reference to `_imp__glColor3fv'
glm.o:glm.cpp:(.text+0x603d): undefined reference to `_imp__glNormal3fv'
glm.o:glm.cpp:(.text+0x606b): undefined reference to `_imp__glNormal3fv'
glm.o:glm.cpp:(.text+0x6093): undefined reference to `_imp__glTexCoord2fv'
glm.o:glm.cpp:(.text+0x60b6): undefined reference to `_imp__glVertex3fv'
glm.o:glm.cpp:(.text+0x60e4): undefined reference to `_imp__glNormal3fv'
glm.o:glm.cpp:(.text+0x610c): undefined reference to `_imp__glTexCoord2fv'
glm.o:glm.cpp:(.text+0x6130): undefined reference to `_imp__glVertex3fv'
glm.o:glm.cpp:(.text+0x615e): undefined reference to `_imp__glNormal3fv'
glm.o:glm.cpp:(.text+0x6186): undefined reference to `_imp__glTexCoord2fv'
glm.o:glm.cpp:(.text+0x61aa): undefined reference to `_imp__glVertex3fv'
glm.o:glm.cpp:(.text+0x6211): undefined reference to `_imp__glGenLists'
glm.o:glm.cpp:(.text+0x6229): undefined reference to `_imp__glNewList'
glm.o:glm.cpp:(.text+0x6242): undefined reference to `_imp__glEndList'
collect2: ld returned 1 exit status

make.exe: *** [OpenGL_LoadingModels.exe] Error 1
Execution terminated
Was This Post Helpful? 0
  • +
  • -

#7 kennyyy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 14-November 12

Re: Linker Error while using GLM for loading model in OpenGL

Posted 14 November 2012 - 03:32 PM

Hi,

I re-open this topic more than one year later because I've got exactly the same problem and impossible to find any solution... I have used glm in a project together with opengl and glut and it's work properly on Linux. I'me trying to port it under Windows and get this error. Does anyone have an idea now ? dragonx99, do you finaaly success in compiling this stuff ?

Thanks

Vincent
Was This Post Helpful? 0
  • +
  • -

#8 kennyyy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 14-November 12

Re: Linker Error while using GLM for loading model in OpenGL

Posted 14 November 2012 - 03:42 PM

I got it !

I don't know if someone will be interested but you just need to include windows.h as the first header in glm.h and glmimg.h ...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1