MinGW g ++:使用to_string时vsnprintf的多个定义 [英] MinGW g++: Multiple definition of vsnprintf when using to_string
本文介绍了MinGW g ++:使用to_string时vsnprintf的多个定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚开始在Windows上使用MinGW.尝试使用
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\..\Local\Temp\cc4sJDvK.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,异常:矮级和内部版本:2.
我希望这会有所帮助.
这篇关于MinGW g ++:使用to_string时vsnprintf的多个定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文