Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: TuxD3v on January 30, 2011, 01:00:08 am
-
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...
-
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
-
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
-
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
-
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
-
hi,
thanks for the help...
what you are saying to me is that i need to do the same for the compiler and the linker like this :
Project -> Build options -> Compiler settings -> Other Options--> "-pthread"
Project -> Build options -> Linker settings -> Other Linker Options-->"-pthread"
is this...?
In codeblocks is possible to make debuging in a multithread program?
thanks in advance.
lmx
-
1. Yes, you need both, but you can check in the docs, I've read them long ago, so I might remember it wrongly...
2. Yes, you can debug multi-threaded programs, have you tried?