ChinaUnix.net
相关文章推荐:

undefined reference to `pthread_create

程序如下: #include "apue.h" #include <pthread.h> pthread_t ntid; void printids(const char *s) { pid_t pid; pthread_t tid; pid = getpid(); tid = pthread_self(); printf("%s pid %u tid %u (0x%x)\n", s, (unsigned int)pid, (unsigned int)tid, (unsigned int)tid); } void * thr_fn(void *arg) { printids("new thread: "); return((void *)0); } int main(void) { int err; err = pthread_create...

by zxbjlu1983 - 程序开发 - 2006-08-21 11:14:37 阅读(4967) 回复(5)

相关讨论

/tmp/ccJl8mqQ.o(.text+0x497): In function `main': : undefined reference to `pthread_create' 我在函数里创建了线程,也有#include <pthread.h> 不知道为何抱这个错,请问怎样解决。谢谢大家了

by pxpbba - 程序开发 - 2005-12-27 14:03:09 阅读(843) 回复(2)

主线程pthread_create创建一堆线程序,正常执行,收到reset命令后,执行pthread_cancel停止开始启动的线程,重新读参数,再次pthread_create,但是这次pthread_create函数就block在那里了. 请高人指教. 是否跟thead tls有关系.

by hmf888 - C/C++ - 2007-12-18 10:07:04 阅读(1790) 回复(1)

int main() { int pcount=10; unsigned char *kk = "1312312039423095sdlk#*&^$", oo[60]; int len_s, *len_d, i, ret; for(i=0; ipthread_create(&pthid, NULL, (void *) LHash(kk, oo, len_s, &len_d), NULL); printf("i=%d\n", i); printf("oo=%s\n", oo); } } 大家请看这个程序到i=1的时...

by mousexqshe - C/C++ - 2007-07-18 17:36:11 阅读(3713) 回复(11)

为什么这个程序编译不了? 完全和书上一样啊?pthread_create 有什么问题吗? 编译结果: [wanglt@sz-gw multi]$ make hello_multi cc hello_multi.c -o hello_multi /tmp/ccNeEOUL.o: In function `main': /tmp/ccNeEOUL.o(.text+0x17): undefined reference to `pthread_create' /tmp/ccNeEOUL.o(.text+0x2f): undefined reference to `pthread_create' /tmp/ccNeEOUL.o(.text+0x3f): undefined reference to `pthread_jo...

by dell9 - C/C++ - 2006-05-17 11:45:43 阅读(1438) 回复(2)

设置 signal(SIGCHLD,ChildThreadQuitSignal); 然后用 pthread_create()创建新线程 当 新创建的线程退出时主线程没有执行ChildThreadQuitSignal(), 是否用pthread_create创建的新线程父线程不是创建它的线程,好像用fork就可以的,能有什么办法让pthread_create创建出来的线程在退出时通知主线程呢,求各位老大帮忙,在线等

by relaxxxxx - C/C++ - 2005-07-08 14:04:05 阅读(1067) 回复(6)

请教一下各位高手 我的程序在redhat上运行是可以的,但是弄到AS3重新编译后在出现pthread_create时段错误。 下面是我写的一个小测试程序,也有同样的问题 #include <pthread.h> #include #include void* hello() { printf("hello, lgf\n"); } int main() { pthread_t thread; pthread_create(&thread, NULL, hello, NULL); pthread_detach(thread); sleep(5); ...

by Ediml - C/C++ - 2008-01-04 10:47:12 阅读(5541) 回复(14)

在solaris9下第一次调用pthread-create就返回EAGAIN,这是为什么呢?但是在redhat9下就没问题!

by mike_chen - C/C++ - 2005-08-30 09:29:36 阅读(1752) 回复(1)

设置 signal(SIGCHLD,ChildThreadQuitSignal); 然后用 pthread_create()创建新线程 当 新创建的线程退出时主线程没有执行ChildThreadQuitSignal(), 是否用pthread_create创建的新线程父线程不是创建它的线程,好像用fork就可以的,能有什么办法让pthread_create创建出来的线程在退出时通知主线程呢,求各位老大帮忙,在线等

by relaxxxxx - HP-UX - 2005-07-08 22:53:06 阅读(996) 回复(1)

[code]代码如下 void * MainLoop(void *) { cout << "run in thread " << endl; sleep(10); return NULL; } int main(int argc,char **argv) { pthread_t thread; int ret = pthread_create(&thread,NULL,MainLoop,NULL); if(ret != 0) cout << "create failed " << endl; getchar(); return 0; } [/code] //代码大致是这样...

by Moonwellatg4 - C/C++ - 2005-04-22 13:29:51 阅读(971) 回复(5)

比如有个函数原形 void* myfunc(void* param); 要求写一个函数 RunThreads,可以创建(pthread_create)线程myfunc,大致为: void RunThreads(...Func) { ...... pthread_create(, NULL,...Func,NULL); ...... } 调用方式: RunThreads(...myfunc);//启动线程

by mymmsc - C/C++ - 2004-04-06 20:21:58 阅读(1538) 回复(4)