I asked a question about this earlier but I hadn't done hours of research yet. My C++ compiler appears to be fine, but my computer cannot run .exe which were compiled from C++ code using the vector class if the vector has any contents. Here is some extremely basic code that cannot run (no errors thrown, nothing is printed) as a result of this:
#include <vector>
#include <iostream>
using namespace std;
int main()
{
printf("Hello!\n");
std::vector<int> myints;
// myints.push_back(1);
// vector<int> myvector = {10,20,30,40,50};
return 0;
}
With both of those two lines commented out, the code prints Hello! as expected. If either line is uncommented, my computer cannot run the .exe that is built. I thought this was likely a compiler issue so I uninstalled and reinstalled g++ on Windows. Same results.
Then I had a friend compile my code, both with the lines commented and uncommented. He sent me the resulting .exes. The one with both lines commented produced the Hello! output, the one with them uncommented did not. I compiled the code (lines uncommented) and sent him the .exe and it ran.
This is not an issue unique to my compiler, this is coming from my machine somehow. I can do other C++ stuff just fine, like allocating space for an array with malloc() but I want to append stuff onto a list so I need vector to work.
std::array
orstd::list
etc. Do you get the same problem with them as well?