If your program only includes header files of the C++ standard library, you're very likely trying to compile it with gcc 3.x for MinGW; if so, define the symbol __GTHREAD_HIDE_WIN32API on the compiler command line:
g++ -D__GTHREAD_HIDE_WIN32API program.cpp -lalleg
