Ste*_*ven 13 compiler-construction portability gcc pthreads
我有一个pthreads程序.我必须在Linux中使用gcc -pthread编译它(-pthreads是无法识别的选项)和Sun中的gcc -pthreads(-pthread是无法识别的选项).为什么不同,因为它是相同的编译器?但是,-lpthread适用于两者,但我听说这并不总是足够的.
Alo*_*hal 14
Solaris -pthreads和Linux -pthread选项具有相同的功能.显然,gcc-4.x系列也接受-pthreadSolaris.
编译时确实需要-pthread/ -pthreadsoption,因为它在预处理器和链接器中添加了多线程支持.