Trouble Getting A Tinysdgl Environment Set Up


SatNav

Still Fresh
Joined
Dec 25, 2005
Messages
4
Hey there,

So as I said, I'm trying to get a simple TinySDGL demo to compile on my windows PC.

I installed the windows devkit, and SDL, made sure that was all working ok. Then I installed the TheOddBot library pack, and tried to compile and got a bunch of libraries not found. I dug around on my hard drive and found the ones I needed in a devkit that I installed months ago and forgot about (possibly a different version from the one I'm now using). So I copied them into /lib, and that seemed ok.

Thing is, now I get a bunch of undefined references to maths functions like sin, cos and pow, and I have no idea how to fix them. They go along the lines of:

C:\devkitGP2X\lib\libTinyGLU.a(glu.o) In function `drawTorus':
[Linker error] undefined reference to `cos'

There's virtually no tinySDGL documentation that I can find, and I've searched the forums and not found anyone with similar problems.

Can anyone help me out here?

cheers,
SatNav
 
Does TinySDGL come with any library files? (.a/.lib). Have you linked them to the project?

edit: Ignore this comment, I didn't read the post properly
 
Thanks Parky, that worked fine. What exactly does -lm mean? Just so I know where to use it in future.

One other thing: once all the maths errors were cleared up, there were some others left over, that I hadn't spotted mixed in with all the maths ones. they seem to be about 'pthread' and 'semaphore', and go something like:

C:\devkitGP2X\lib\libSDL.a(SDL_systhread.o) In function `RunThread':
[Linker error] undefined reference to `pthread_exit'

and:

C:\devkitGP2X\lib\libSDL.a(SDL_syssem.o) In function `SDL_CreateSemaphore':
[Linker error] undefined reference to `sem_init'

I do have 'lpthread' in my linker options, if it makes a difference.. I'm guessing not.

Thanks again,
SatNav
 
SatNav posted on May 19 2006 at 03:11 PM said:
Thanks Parky, that worked fine. What exactly does -lm mean? Just so I know where to use it in future.

One other thing: once all the maths errors were cleared up, there were some others left over, that I hadn't spotted mixed in with all the maths ones. they seem to be about 'pthread' and 'semaphore', and go something like:

C:\devkitGP2X\lib\libSDL.a(SDL_systhread.o) In function `RunThread':
[Linker error] undefined reference to `pthread_exit'

and:

C:\devkitGP2X\lib\libSDL.a(SDL_syssem.o) In function `SDL_CreateSemaphore':
[Linker error] undefined reference to `sem_init'

I do have 'lpthread' in my linker options, if it makes a difference.. I'm guessing not.

Thanks again,
SatNav

The order of the libraries matters. -lpthread should be after -lSDL

-l makes the linker look for a particular library. The standard location is C:\devkitGP2X\lib but you can add extra locations with -L in the same way include paths are added with -I (capital i).

If you add -lm then linker will look for libm.a (static) or libm.so (shared). In the
same way -lSDL refers to libSDL.a
 
Last edited by a moderator:
Cool, thanks man, I'm all set now.

Now if only I could figure out how to get rid of that damned cursor (j/k, I know how to do that :D )

Cheers again.
 
Back
Top