HELP!: Undefined References in compile!

Hi!

I have installed the C-Forge development IDE and have installed V1.2 of the
SDL libs.

When I compile my program, I am confronted with these error msgs! :

/usr/lib/libSDL.so: undefined reference to ‘pthread_create’
/usr/lib/libSDL.so: undefined reference to ‘pthread_cancel’
/usr/lib/libSDL.so: undefined reference to ‘sem_destroy’
/usr/lib/libSDL.so: undefined reference to ‘sem_wait’
/usr/lib/libSDL.so: undefined reference to ‘sem_post’
/usr/lib/libSDL.so: undefined reference to ‘pthread_mutexattr_setkind_np’
/usr/lib/libSDL.so: undefined reference to ‘sem_init’
/usr/lib/libSDL.so: undefined reference to ‘pthread_sigmask’
/usr/lib/libSDL.so: undefined reference to ‘sem_trywait’
/usr/lib/libSDL.so: undefined reference to ‘pthread_mutexattr_init’
/usr/lib/libSDL.so: undefined reference to ‘sem_getvalue’
/usr/lib/libSDL.so: undefined reference to ‘pthread_join’
/usr/lib/libSDL.so: undefined reference to ‘pthread_cond_timedwait’

I am running Linux Mandrake 7.2 and I un-installed the V1 of the SDL libs
that came with it before installing V1.2.

I have set the include dir and the lib info into the build box’s in the
compile options and it compiles the sources no problems, yet it then throws
those errors up!

I know the program works, because I wrote it when I used SuSE Linux 7 and
wrote the code in K-Develop but have moved over to this current Linux (much
better I think!)

thanx in advance

Mark.

Hello,

I think all you need is to link your program with the Posix thread library:
just add -lpthread

DavidOn Tue, 17 Apr 2001, Mark Jervis wrote:

Hi!

I have installed the C-Forge development IDE and have installed V1.2 of the
SDL libs.

When I compile my program, I am confronted with these error msgs! :

/usr/lib/libSDL.so: undefined reference to ‘pthread_create’
/usr/lib/libSDL.so: undefined reference to ‘pthread_cancel’
/usr/lib/libSDL.so: undefined reference to ‘sem_destroy’
/usr/lib/libSDL.so: undefined reference to ‘sem_wait’
/usr/lib/libSDL.so: undefined reference to ‘sem_post’
/usr/lib/libSDL.so: undefined reference to ‘pthread_mutexattr_setkind_np’
/usr/lib/libSDL.so: undefined reference to ‘sem_init’
/usr/lib/libSDL.so: undefined reference to ‘pthread_sigmask’
/usr/lib/libSDL.so: undefined reference to ‘sem_trywait’
/usr/lib/libSDL.so: undefined reference to ‘pthread_mutexattr_init’
/usr/lib/libSDL.so: undefined reference to ‘sem_getvalue’
/usr/lib/libSDL.so: undefined reference to ‘pthread_join’
/usr/lib/libSDL.so: undefined reference to ‘pthread_cond_timedwait’

I am running Linux Mandrake 7.2 and I un-installed the V1 of the SDL libs
that came with it before installing V1.2.

I have set the include dir and the lib info into the build box’s in the
compile options and it compiles the sources no problems, yet it then throws
those errors up!

I know the program works, because I wrote it when I used SuSE Linux 7 and
wrote the code in K-Develop but have moved over to this current Linux (much
better I think!)

thanx in advance

Mark.

Hi!

I have installed the C-Forge development IDE and have installed V1.2 of the
SDL libs.

When I compile my program, I am confronted with these error msgs! :

/usr/lib/libSDL.so: undefined reference to ‘pthread_create’
/usr/lib/libSDL.so: undefined reference to ‘pthread_cancel’
/usr/lib/libSDL.so: undefined reference to ‘sem_destroy’
/usr/lib/libSDL.so: undefined reference to ‘sem_wait’
/usr/lib/libSDL.so: undefined reference to ‘sem_post’
/usr/lib/libSDL.so: undefined reference to ‘pthread_mutexattr_setkind_np’
/usr/lib/libSDL.so: undefined reference to ‘sem_init’
/usr/lib/libSDL.so: undefined reference to ‘pthread_sigmask’
/usr/lib/libSDL.so: undefined reference to ‘sem_trywait’
/usr/lib/libSDL.so: undefined reference to ‘pthread_mutexattr_init’
/usr/lib/libSDL.so: undefined reference to ‘sem_getvalue’
/usr/lib/libSDL.so: undefined reference to ‘pthread_join’
/usr/lib/libSDL.so: undefined reference to ‘pthread_cond_timedwait’

These all look like pthreads issues.

Are you using the standard $(shell sdl-config --libs) in your library
variable(s) in your makefile(s)?

Also… do you have libpthreads installed? :wink:

I am running Linux Mandrake 7.2 and I un-installed the V1 of the SDL libs
that came with it before installing V1.2.

I know the program works, because I wrote it when I used SuSE Linux 7 and
wrote the code in K-Develop but have moved over to this current Linux (much
better I think!)

I use Kdevelop on Tux Typing, and I know that some of the information which has
been linked from the SDL site is not completely correct.

For Kdevelop (and maybe someone needs to update the Linux FAQ to reflect this,
hint, hint :wink: you need to go to your Project Options dialog, select the
"Linker Options" tab, and under the “Additional Flags” section add the
following:

$(shell sdl-config --cflags) $(shell sdl-config --libs)On Tue, 17 Apr 2001, you wrote:


Sam “Criswell” Hart <@Sam_Hart> AIM, Yahoo!:
Homepage: < http://www.geekcomix.com/snh/ >
PGP Info: < http://www.geekcomix.com/snh/contact/ >
Advogato: < http://advogato.org/person/criswell/ >

Mark Jervis wrote:

I have set the include dir and the lib info into the build box’s in the
compile options and it compiles the sources no problems, yet it then throws
those errors up!

How did you set it up?? You should set your linker flags to:
sdl-config --libs which adds -lpthread when its used.

-- David Snopek

/-- libksd –
| The C++ Cross-Platform Game Framework
| Only want to write it once??
| http://libksd.sourceforge.net
------------

David Ergo wrote:

Hello,

I think all you need is to link your program with the Posix thread
library: just add -lpthread

David

Hi!

I have installed the C-Forge development IDE and have installed V1.2 of
the SDL libs.

When I compile my program, I am confronted with these error msgs! :

/usr/lib/libSDL.so: undefined reference to ‘pthread_create’
/usr/lib/libSDL.so: undefined reference to ‘pthread_cancel’
/usr/lib/libSDL.so: undefined reference to ‘sem_destroy’
/usr/lib/libSDL.so: undefined reference to ‘sem_wait’
/usr/lib/libSDL.so: undefined reference to ‘sem_post’
/usr/lib/libSDL.so: undefined reference to
’pthread_mutexattr_setkind_np’ /usr/lib/libSDL.so: undefined reference
to ‘sem_init’ /usr/lib/libSDL.so: undefined reference to
’pthread_sigmask’ /usr/lib/libSDL.so: undefined reference to
’sem_trywait’ /usr/lib/libSDL.so: undefined reference to
’pthread_mutexattr_init’ /usr/lib/libSDL.so: undefined reference to
’sem_getvalue’ /usr/lib/libSDL.so: undefined reference to ‘pthread_join’
/usr/lib/libSDL.so: undefined reference to ‘pthread_cond_timedwait’

I am running Linux Mandrake 7.2 and I un-installed the V1 of the SDL
libs that came with it before installing V1.2.

I have set the include dir and the lib info into the build box’s in the
compile options and it compiles the sources no problems, yet it then
throws those errors up!

I know the program works, because I wrote it when I used SuSE Linux 7
and wrote the code in K-Develop but have moved over to this current
Linux (much better I think!)

thanx in advance

Mark.

THANK YOU!!! it worked!!! :o)

I LOVE linux!! hehe… wherelse are ppl so helpfull!!

Mark.> On Tue, 17 Apr 2001, Mark Jervis wrote: