User forums > Using Code::Blocks

Problems with code blocks threading

(1/2) > >>

TuxD3v:
hi,
i have some troubles with a C program that i made,... for compiling it in code blocks i am using gcc and i am in ubuntu.

this is my thread call function:
pthread_create(&gothreads,NULL, workload,&newuser);

when i try to compile the entire project the code blocks give me the following error message:
pthread_create(&gothreads,NULL, workload,&newuser);

 i put in compiler settings->other settings
-lpthread
what’s going wrong??
help please...

TuxD3v:
sorry the error is :
xpto.c|188|undefined reference to `pthread_create'|
i made the #include <pthread.h>
wats wrong??
help please

thanks in advance
lmx

stahta01:
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

TuxD3v:
hi,
thanks for the attention, but i am in Ubuntu, and my problem is how i can put the flag -lpthread in the compiler...for now i have a dynamic library for the linker:
/usr/lib/libpthread.so and it is working but its a dynamic library, i want to compile with a static library.....how i can do something like this gcc -c --lpthread....xpto ?

thanks for the attention.
lmx

oBFusCATed:
Project -> Build options -> Linker -> Other

Also you've not read the gcc docs carefully ... the correct flag is -pthread and you should pass it in both stages: compilation and linking

Navigation

[0] Message Index

[#] Next page

Go to full version