When I run this simple code in Ubuntu (Ubuntu 13.10, 64 bits, g++ 4.8.1) :
#include <iostream>
#include <typeinfo>
#include <string>
using namespace std;
int main(void)
{
const type_info &ti_trait = typeid(char_traits<char>::char_type);
cout << "Traits character type name : " <<
ti_trait.name() << endl;
return 0;
}
everything is OK, but in Windows (Windows 8 64 bits, mingw, g++ 4.8.1), I got "The program has stopped working" (the compilation works fine and -Wall produces no warning).
The same code compiled and executed in Visual Studio works correctly.
Any idea?
The solution is to compile with
-static-libgcc -static-libstdc++
(see here for an explaination). Thanks to @sftrabbit.