I have a Qt C++ application that compiles fine with the MSVC compiler. Now I’m trying to compile the same application with MinGW so that I can eventually port it to Mac OSX. However, when doing so I’m getting an error on all the standard includes:
#include <algorithm>
#include <ctime>
#include <map>
#include <sstream>
#include <vector>
And the compiler outputs:
..\trunk\stable.h:29:21: error: algorithm: No such file or directory
..\trunk\stable.h:30:17: error: ctime: No such file or directory
..\trunk\stable.h:31:15: error: map: No such file or directory
..\trunk\stable.h:32:19: error: sstream: No such file or directory
..\trunk\stable.h:33:18: error: vector: No such file or directory
I really don’t understand what could be causing this issue. Any suggestion?
This is one of the more common errors you will see if your source is C++ but is being compiled as C.
This in turn can happen if the source uses
.C(note capital C) extension for C++ files. If the source is used in a case-insensitive file system (like all of the windows ones generally) thenmakeprobably won’t be able to properly tell whether to compile them as C or C++.By default,
make(including the mingw version) will compile C++ source from extensions.C,.ccand.cpp. (This page has the details).You have 3 options:
.ccand.cppare the easiest to work with.makefile, you can goCC=mingw32-g++ mingw32-make -f Makefile.Debugyou can add this to the
makefileor one of the included files:but this will only work if the makefile(s) haven’t changed the rules for compilation.