Having been playing with the tutorials a bit, I'm getting very odd crashes for code that should be fine (I've played with both C and Java before). The following code describes my issues:
#include <iostream>
#include <string>
usingnamespace std;
int main () {
//Works
cout << "Hello World\n";
//Works
char c[] = "Hello World\n";
cout << c;
//Crashes on cout
int i = 2;
cout << i;
//Crashes on the string declaration
string str = "Hello World\n";
cout << str;
return 0;
}
There's nothing in there at all that should be causing a crash - the only possibly exception being that my string declaration is wrong for C++, but it seems fine.
I'm running on MinGW 4.8.1, which is all I can think of being at fault. However, I've used it quite happily for C for a long time.
You have to completely remove old installations before upgrading to new ones - files can be deleted in newer versions but simply copying over the old version won't delete the files, and you'll confuse the compiler.