我在用pthread.h
in a *.cc
文件。当我尝试使用时pthread_exit(0);
or pthread_join(mythrds[yy],NULL);
它说:
.cc:(.text+0x3e): undefined reference to `pthread_exit'
当在 a 中编译非常相似的代码时*.c
使用 gcc 文件它工作完美。我如何在c++中使用pthread..(我还添加了-lpthread)
..
void *myThreads ( void *ptr )
{
...
pthread_exit(0);
}
..
flags:
g++ -lpthread -Wall -static -W -O9 -funroll-all-loops -finline -ffast-math
您可以尝试使用 g++ 的 -pthread 选项。
-pthread
Adds support for multithreading with the pthreads library. This
option sets flags for both the preprocessor and linker.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)