Problem with gltReadTGABits

Hi!

So I have been working through the OpenGL superbible and I have just started learning how to texture objects, but I’ve hit a problem. When I try to run my code I get the following error:

Undefined symbols for architecture x86_64:
“gltReadTGABits(char const*, int*, int*, int*, unsigned int*)”, referenced from:
LoadTGATexture(char const*, unsigned int, unsigned int, unsigned int) in texturedPyramid.o
(maybe you meant: __Z14gltReadTGABitsPKcPiS1_S1_PjPa)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The problem isn’t with my code as I get the same error when I try compile the source code for the example programs. After 2 hours of googling I am still completely clueless so hopefully someone here cam explain what the problem might be.

Thanks in advance.

Did you link to the “glt” library that comes with the OpenGL Superbible? If you didn’t, then you can’t use “gltReadTGABits”.

I believe so. I followed the instructions in the book, linking to gltools/include in the header search path, and copying the libGLTools.a file into the frameworks folder. I haven’t had any problems with gltools method calls in previous chapters.

Okay I have found a temporary solution. I have copied the gltReadTGAbits function from gltools.cpp into my source code and renamed it ReadTGAbits and my code now works. Still not sure why it didn’t work in the first place though?

I hit the same problem last night and did what you suggested above to workaround the problem to get it working. I also had to copy the TGAHEADER struct from GLTools.cpp into Pyramid.cpp

It seems to me that libGLTools.a that is provided is outdated. Perhaps rebuilding that might help though I do not know how to do that. If any one has success, please post to this thread

Simply link to gltools/src as you previously linking to gltools/include in the header search path

Oh and andd this line of code to you c++ file:

#include <GLTools.cpp>

I encountered the same problem with u
I solved it by recompiling the libGTLTools.a file (I am using mac os x system)
hope this can help u

I tried recompiling libGLTools.a - I am also using max os x

I opened a terminal and did the following:
$ cd <path_to source_files>
$ g++ -c *.cpp -I…/include
$ g++ -c glew.c - I…/include
$ ar rcs libGLTools.a *.o

This did not help either.

If you could provide the details of how you did the recompile, that would be very useful to me.

Thanks