【发布时间】:2011-02-10 09:57:01
【问题描述】:
我在*.cc 文件中使用pthread.h。当我尝试使用pthread_exit(0); 或pthread_join(mythrds[yy],NULL); 时,它会说:
.cc:(.text+0x3e): undefined reference to `pthread_exit'
当使用 gcc 在 *.c 文件中编译非常相似的代码时,它可以完美运行。如何在 c++ 中使用 pthread ..(我还添加了 -lpthread)
..
void *myThreads ( void *ptr )
{
...
pthread_exit(0);
}
..
标志:
g++ -lpthread -Wall -static -W -O9 -funroll-all-loops -finline -ffast-math
【问题讨论】:
标签: c++ linker pthreads linker-errors