Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: Dark867 on May 12, 2008, 03:55:32 pm
-
Hi,I'm starting thread programming using Linux's pthread.h library and I got this error with code::blocks:
||=== pthread, Debug ===|
obj/Debug/main.o||In function `main':|
/home/xxx/workspace/pthread/main.cpp|17|undefined reference to `pthread_create'|
||=== Build finished: 2 errors, 0 warnings ===|
The problem seems to be in the linker,in fact if I try to compile the same program from console using the istruction
g++ -lpthread -o <program_name> main.o
everything works perfectly.
How to make code::blocks use the same istruction?Thanks much for answers!
-
Put "pthread" to your lin-libraries in the prohjects build options.
Right-click your project in the manager and click "Build options".
In the dialog chose your project (not one of the build-targets), click "Linker Settings" and add "pthread" (without the quotes) to the link libraries.
-
Thanks so much!
I already feared to be condamned to use gedit+console :D