开发者

undefined reference to pthread_create in c program on eclipse (Fedora)

开发者 https://www.devze.com 2023-01-28 04:31 出处:网络
I have a problem in building a c thread program. Pr开发者_高级运维ogram is giving error like \"undefined reference to pthread_creat\".

I have a problem in building a c thread program. Pr开发者_高级运维ogram is giving error like "undefined reference to pthread_creat". I searched and found to use gcc options like "gcc -lpthread -o ...."

But I not able to set it for eclipse. I tried to make change in makefile but every time it got replaced with default options. Please help me to set these gcc options and write about where and how to set gcc options in eclipse on fedora 10.

Thanks,

Lokesh


to add pthread library to your project flow these steps (in eclipse):

right cklick on the project in the project explorer -> properties -> c/c++ build -> Settings -> linker -> libraries -> add -> pthread -> ok -> rebuild


Check this 'tutorial' on about how to setup eclipse for developing posix threads.

Hope it helps.


To add pthread library to your non-makefile project, do following steps (in eclipse):

right click on the project in the project explorer. Select properties -> c/c++ general -> Paths and Symbols -> libraries -> add -> type 'pthread' in text box -> ok -> ok -> rebuild

0

精彩评论

暂无评论...
验证码 换一张
取 消