我使用这里提供的mingw工具链:http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.7.2/32-bit/threads-posix/sjlj/x32-4.7.2-release-posix-sjlj-rev2.7z/download
我已经成功地使用参数-static-libgcc -static-libstdc++
来静态链接libstdc++-6.dll
和libgcc_s_sjlj-1.dll
,但是我找不到一个能够做同样事情的命令来链接libwinpthread-1.dll
。
libgcc
和libstdc++
有静态和非静态(DLL)版本,如果您静态链接,则不会链接到 DLL。您应该静态链接到pthreads
库,而不是libwinpthread-1.dll
(因为您无法静态链接到动态库...这违背了动态库的目的)。 - Cornstalksc++: error: unrecognized command line option '-static-pthreads'
,同样的问题也出现在winpthreads
上。 - rsk82-l:libwinpthread.a
。 - superbem