#error WINDOWS.H already included. MFC apps must not #include <windows.h>

First, see what translation unit (cpp file) was compiled when the error occured (see build log).

Then... you could either inspect the header files included by that cpp file, looking for <windows.h>.

You could also search in all project files for to check whether it is included from your code.

If you're using other 3rd party libraries that include windows.h header, then you might be forced to change the order of inclusion of those header files and MFC headers.


Try turning on "Show Includes" in the projects settings (C/C++ -> Advanced). This show give you an indication of what header files are included and in what order - you should be able to trace back from there


Change the include order, and include afx < headers > before the others

Tags:

Windows

C++

Mfc