Reputation: 1177
I recently installed MinGW and MSYS on my Windows 32 machine and it seems to be running fine.
On the C++ compiler, I am including a vector container and getting no errors to that. But I`m getting compile-time errors when I try to use it.
So, the code
#include <vector> // include vector.h
#include <stdio.h> // include stdio.h
using namespace std;
main() {
// vector<int> A;
printf("\nHeya ..");
}
is running just fine. However, the moment I un-comment line 8-- the vector declaration line, I get the following error (shortened) in compile time:
undefined reference to 'operator delete(void*)'
undefined reference to '__gxx_personality_v0'
Upvotes: 1
Views: 4927
Reputation: 9161
I don't see how you are compiling your code. Your main method is invalid, incorrect signature and you aren't returning anything.
Should be like this:
#include <vector> // include vector.h
#include <stdio.h> // include stdio.h
using namespace std;
int main(int, char**) {
// vector<int> A;
printf("\nHeya ..");
return 0;
}
Also you need to compile this with g++ and not gcc.
Upvotes: 0
Reputation: 490108
You're probably compiling with gcc
instead of g++
. The actual compiler is the same, but g++
tells the linker to use the default C++ libraries, were gcc
only tells it to look at the C libraries. As soon as you use and C++-specific parts of the standard library, gcc
will fail.
As an aside, C++ doesn't support the default int
rule from old C, so you should really specify the return type from main
.
Upvotes: 9