当前位置: 技术问答>linux和unix
非常简单的线程错误!
来源: 互联网 发布时间:2015-05-08
本文导语: # gcc -Wall -o thread thread.c /tmp/ccDFgW2C.o: In function `main': /tmp/ccDFgW2C.o(.text+0x54): undefined reference to `pthread_create' /tmp/ccDFgW2C.o(.text+0xba): undefined reference to `pthread_join' collect2: ld returned 1 exit status 为什么用: # ...
# gcc -Wall -o thread thread.c
/tmp/ccDFgW2C.o: In function `main':
/tmp/ccDFgW2C.o(.text+0x54): undefined reference to `pthread_create'
/tmp/ccDFgW2C.o(.text+0xba): undefined reference to `pthread_join'
collect2: ld returned 1 exit status
为什么用:
# gcc -c thread.c
linux:/home/picpic/thread # ls
. .. thread.c thread.o
没有问题 gcc -Wall -o thread thread.c 就出现问题了呢,如此啊。。。
source code :
#include
#include
void thread(void)
{
int i;
for (i=0;i
/tmp/ccDFgW2C.o: In function `main':
/tmp/ccDFgW2C.o(.text+0x54): undefined reference to `pthread_create'
/tmp/ccDFgW2C.o(.text+0xba): undefined reference to `pthread_join'
collect2: ld returned 1 exit status
为什么用:
# gcc -c thread.c
linux:/home/picpic/thread # ls
. .. thread.c thread.o
没有问题 gcc -Wall -o thread thread.c 就出现问题了呢,如此啊。。。
source code :
#include
#include
void thread(void)
{
int i;
for (i=0;i