您的位置:首页 > 编程语言 > C语言/C++

关于MinGW GCC编译C++程序动态链接到libgcc_s_dw2-1.dll的问题

2013-05-19 21:15 471 查看
如果你使用MinGW GCC 4.4.0默认选项编译C++程序,就会动态链接到libgcc_s_dw2-1.dll,编译后的执行文件运行时会出现错误:



 

其中的原因:

Dynamic linking with libgcc_s_dw2-1.dll is necessary to throw exceptions between different modules, such as between two DLLs or a DLL and an EXE. Consequently, it is the default for all languages other than C.

 

解决办法:

To disable this dynamic linking, use -static-libgcc. To enable this dynamic linking in C, use-shared-libgcc.

 

Eclipse中参数设置方法:

To add this flag in Eclipse, go to Project->Properties. Under "C++ Build", select "Settings". Under "MinGW C++ Linker", select "Miscellaneous". Add "-static-libgcc" to the "Linker flags" field. You may have to do this for your other build configurations and
projects.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐