A little Problem

Hi!!!
I hope you understand my english, it isn’t very good.
I have problems to compile a simple SDL C++ code (I’ve already compiled
some demos without any problem). the code is verry simple, only to show
a window. I think the code is right, but, whenever I want to compile it
(I use g++, Linux), I get the following Messages:

main.cpp: In function ‘int main(int,char **)’_
main.cpp:16:warning: implicit declaration of function ‘int atexit(…)’
/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 ‘pthread_sigmask’
/usr/lib/libSDL.so: undefined reference to 'pthread_join’
collect2: ld returned 1 exit status

Do anybody know, what I make wrong? to compile, I use the command:

g++ main.cpp -o main -lSDL

istn’t that right?
thank you for any help!!!

cu
Peter

Peter Kling wrote:

g++ main.cpp -o main -lSDL

istn’t that right?

Add -lpthread to this line.

Or better sdl-config --libs which will output something like :
"-L/usr/local/lib -lSDL -lpthread"…–
Damien Chavarria.

Hello Peter

Try running the following commands, and use the output as compile flags
sdl-config --cflags
sdl-config --libs

As an example you need to link to pthreads lib…

Best regards
Thomas

Peter Kling wrote:>

Hi!!!
I hope you understand my english, it isn’t very good.
I have problems to compile a simple SDL C++ code (I’ve already compiled
some demos without any problem). the code is verry simple, only to show
a window. I think the code is right, but, whenever I want to compile it
(I use g++, Linux), I get the following Messages:

main.cpp: In function ‘int main(int,char **)’_
main.cpp:16:warning: implicit declaration of function ‘int atexit(…)’
/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 ‘pthread_sigmask’
/usr/lib/libSDL.so: undefined reference to 'pthread_join’
collect2: ld returned 1 exit status

Do anybody know, what I make wrong? to compile, I use the command:

g++ main.cpp -o main -lSDL

istn’t that right?
thank you for any help!!!

cu
Peter