我有一个pthreads程序。我必须在Linux中使用gcc -pthread(-pthreads是无法识别的选项)和Sun中的gcc -pthreads(-pthread是无法识别的选项)进行编译。为什么不同,因为它是相同的编译器?但是,-lpthread适用于两者,但我听说这并不总是足够的。
我有一个pthreads程序。我必须在Linux中使用gcc -pthread(-pthreads是无法识别的选项)和Sun中的gcc -pthreads(-pthread是无法识别的选项)进行编译。为什么不同,因为它是相同的编译器?但是,-lpthread适用于两者,但我听说这并不总是足够的。
Solaris -pthreads
和Linux -pthread
选项做同等的事情。显然, gcc-4.x
系列接受 -pthread
对于Solaris也是如此。
你确实想要 -pthread
/-pthreads
编译时的选项,因为它在预处理器和链接器中添加了多线程支持。