针对你遇到的 undefined reference to 'pthread_join' 错误,以下是一些可能的解决步骤和原因分析: 确认pthread_join函数的正确名称: pthread_join 是POSIX 线程库中用于等待线程终止的函数,其名称是正确的。因此,这一步通常不是问题所在。 检查是否已包含必要的头文件: 在使用 pthread_join 函数之前,需要包含 POSI...
出现下面提示 1linux@ubuntu64-vm:~/workdir$ gcc xiancheng.c -o xiancheng2/tmp/ccOCxLrd.o: In function `main':3xiancheng.c:(.text+0x11e): undefined reference to `pthread_create'4xiancheng.c:(.text+0x131): undefined reference to `pthread_join'5collect2: ld 返回16linux@ubuntu64-vm:~...
undefined reference to 'pthread_create' undefined reference to 'pthread_join' 问题原因: pthread 库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程,以及调用 pthread_atfork()函数建立fork处理程序时,需要链接该库。 问题解决: 在编译中要加 -lpthread参数 gcc ...
/tmp/ccWSGngH.o: In function `main': pthread_join.c:(.text+0x67): undefined reference to `pthread_create' pthread_join.c:(.text+0x8b): undefined reference to `pthread_create' pthread_join.c:(.text+0x9f): undefined reference to `pthread_join' pthread_join.c:(.text+0xb3): undefined...
undefined reference to 'pthread_join' 出现这中问题原因: pthread 库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程,以及调用 pthread_atfork()函数建立fork处理程序时,需要链接该库。 问题解决:
ex04-5-mutex.c:(.text+0x9f): undefined reference to `pthread_join' collect2: ld returned 1 exit status 分析:pthread 库不是 Linux 系统默认的库,连接时须要使用静态库 libpthread.a 处理: 在编译中加 -lpthread 參数 [root@luozhonghua 04]# gcc -lpthread -o mutex ex04-5-mutex.c...
-bash-4.1$ gcc test.c consumers_producers.c /tmp/ccQzS4PV.o: In function `main': test.c:(.text+0x92): undefined reference to `pthread_create' test.c:(.text+0xf2): undefined reference to `pthread_create' test.c:(.text+0x123): undefined reference to `pthread_join' collect2: ld ...
thread_date.c:(.text+0x67): undefined reference to `pthread_create'thread_date.c:(.text+0xaa): undefined reference to `pthread_join'编译失败。 失败原因: pthread 库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程,以及调用 pthread_atfork()函数建立...
undefinedreferencetopthread_create的解决方法 undefinedreferencetopthread_create的解决⽅法 照着GUN/Linux编程指南中的⼀个例⼦输⼊编译,结果出现如下错误:undefined reference to 'pthread_create'undefined reference to 'pthread_join'问题原因:pthread 库不是 Linux 系统默认的库,连接时需要使⽤静态库 lib...
Thread.cpp:(.text+0x50e): undefined reference to `pthread_create' ../Thread.o: In function`muduo::Thread::join()’: Thread.cpp:(.text+0x5ce): undefined reference to `pthread_join’ collect2: error: ld returned 1 exit status