我刚刚开始使用Windows版MinGW。尝试使用创建可执行文件时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()
函数的替代品,但不确定是什么原因导致此错误首先发生。
最佳答案
我使用MinGW w64编译器解决了这个问题
我希望这会有所帮助。
关于windows - MinGW g++ : Multiple definition of vsnprintf when using to_string,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59498009/