g ++无法静态链接stdc ++(windows)

时间:2018-01-16 09:08:25

标签: c++ windows g++


我一直在使用curlpp库做一个简单的c ++程序。我可以正确地构建和编译所有内容,如果在我的PATH中使用MinGW,我可以运行它。当我删除它并复制目录中的所有curlpp dll时,它说(当然):

The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Try reinstalling the program to fix this problem.

我认为问题在于std库没有静态链接,但我尝试了所有可能性,似乎它们没有链接。我输入:

g++ -o myApp.exe main.cpp -std=gnu++11 -L(curl,curlpp,opensll) -I(all includes) -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++  -Wl,-Bdynamic -lcurlpp -lcurl -Wl,--as-needed

没有错误,然后我运行它,我从上面得到错误。当然,如果我的PATH中有MinGW,那么一切正常。

我试图在没有任何运气的情况下更改命令中的选项顺序。按照其他建议放置-static-libgcc -static-libstdc++是行不通的。
提前谢谢你 此致

0 个答案:

没有答案