PDA

View Full Version : Problem loading 3D Model



endlessdark
11-08-2008, 02:06 PM
Hello everybody! I'm coding a 3D image & sound application using a Nintendo's Wiimte for my university.

I've made every basic thing and it's working so now I want to improve some details and one of these is changing the box that represents the wiimote. I have downloaded a wiimote .obj model and the GLM library to load it, I'm also using OpenGL OpenAL and GLUT.

To install de GLM I've downloaded the sources, and made a ./configure,make and make install so I suppose it's installed.

Now time for the makefile. I've added -lglm to the LFLAGS section.

And finally in my code I've added these lines:



...
#include <glm.h>
...
GLMmodel *wiimodel;
...
wiimodel = glmReadOBJ("wiimote.obj");
...


I think it should work but I recieve this error


trackingdemo.o: In function `TrackingDemoInit()':
/home/myuser/Desktop/wiimote3Dsound/trackingdemo.cpp:177: undefined reference to `glmReadOBJ'


:confused:
Some points I don't understand: This error says something like the glm isn't right installed or linked?
And, if is that's the problem, why I'm not gettig an error in the GLMmodel *wiimodel declaration?

Help will be apreciated!
Thank you!

sharp_pixel
11-09-2008, 11:35 AM
The error says the linker can't find the function 'glmReadOBJ' in any of the libraries you linked your program with.
You may need to specify -L path_to_libglm before your -lglm so it can find it.
Try to 'nm' you libglm library to see if the glmReadOBJ is in it (should see 'T' before the symbol).

endlessdark
11-09-2008, 11:51 AM
The error says the linker can't find the function 'glmReadOBJ' in any of the libraries you linked your program with.
You may need to specify -L path_to_libglm before your -lglm so it can find it.
Try to 'nm' you libglm library to see if the glmReadOBJ is in it (should see 'T' before the symbol).



This is the nm output

endlessdark@NoSfeRaTu:/usr/local/lib$ nm libglm.a | grep glmReadOBJ

00002ec0 T glmReadOBJ

And this is my makefile:


# trackingdemo Makefile

CC = g++
CFLAGS = -g -W -Wall -Wno-unused -O2
LFLAGS = -lcwiid -lGL -lbluetooth -lm -lglut -lalut -L /usr/local/lib -lglm

V = @

all: trackingdemo


trackingdemo.o: trackingdemo.cpp
@echo + cc trackingdemo.cpp
$(V)$(CC) $(CFLAGS) -c trackingdemo.cpp

wiiheadtracking.o: wiiheadtracking.cpp
@echo + cc wiiheadtracking.cpp
$(V)$(CC) $(CFLAGS) -c wiiheadtracking.cpp

trackingdemo: trackingdemo.o wiiheadtracking.o
@echo + link main
$(V)$(CC) $(CFLAGS) $(LFLAGS) -o $@ trackingdemo.o wiiheadtracking.o

clean:
@echo + clean
$(V)rm -rf *.o trackingdemo


I think everything is ok but I still get the same error.
This is getting me crazy, I've spent hours even including the glm.h glm.c and glm.o in the same directory and still get the same error over and over :sick: