The error
The exact error is the title of the question.
It happens when I use vectorName.push_back()
function.
I recreated it with just this simple code:
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector <int> vec = {};
vec.push_back(2);
return 0;
}
Compiler and setup information
I'm using msys2, and I set it up using this guide
I have no idea if this is relevant or not, but I used tdm-gcc before this.
Research
A fix is almost nowhere to be found, or I just didn't look hard enough. I have found some posts about the _ZSt28__throw_bad_array_new_lengthv
, but not with entry point. And because I didn't find anything about this exact issue, I didn't try anything.
C:\msys64\mingw64\bin
to the top of the PATH. If this doesn't help, build with-static
or copy the DLLs your program uses next to the .exe (ntldd -R 123.exe
to get the list of dlls, ignore those not present inC:\msys64\mingw64\bin
). – Mugginsg++ -Wall test.cpp && ./a.exe
to compile and run your code in MSYS2's MinGW 64-bit shell? What is the output ofwhich g++
? – Radix