MinGW g++:使用 to_string 时对 vsnprintf 的多重定义 [英] MinGW g++: Multiple definition of vsnprintf when using to_string
本文介绍了MinGW g++:使用 to_string 时对 vsnprintf 的多重定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚开始使用 MinGW for Windows.尝试使用
I just started using MinGW for Windows. When trying to create executable using
g++ a.cpp -o a.exe -std=c++14
下面的代码:
#include <string>
using namespace std;
int main()
{
string x = to_string(123);
return 0;
}
我收到以下错误:
C:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../libmingwex.a(vsnprintf.o):(.text+0x0): multiple definition of vsnprintf
C:Users..LocalTempcc4sJDvK.o:c:/mingw/include/stdio.h:426: first defined here
collect2.exe: error: ld returned 1 exit status
这个错误的根本原因是什么,我怎样才能让它消失?虽然我可以很容易地找到 to_string()
函数的替代品,但我不确定是什么导致了这个错误的发生.
What is the root cause for this error and how can I make it go away? While I can easily find a replacement for to_string()
function I'm not sure what is causing this error to occur in the first place.
推荐答案
我使用 MinGW w64 编译器
- 下载mingw-w64-install.exe
- 设置为版本:6.3.0,架构:i686,线程:posix,异常:dwarf 和构建版本:2.
我希望这会有所帮助.
这篇关于MinGW g++:使用 to_string 时对 vsnprintf 的多重定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文