Problem cannot open include file afxres.h

The "afxres.h" file is a part of MFC that isn't included with Express version of Visual C++. This header file is used by resource files.

To fix this error in all projects, you can create a new "afxres.h" file in the include folder of Windows/Platform SDK containing this code:
Code:
#ifndef __AFXRES_H__
#define __AFXRES_H__

#include <Windows.h>
#include <CommCtrl.h>
#define IDC_STATIC -1

#endif /*__AFXRES_H__*/
There can be more Windows header files that define controls included, but these 2 are sufficient for compiling resources from the most of Orbiter and non-Orbiter projects.

NOTE: The last line of afxres.h file needs to end with enter / new line character, otherwise there will be error: "afxres.h(8): fatal error RC1004: unexpected end of file found".
 
Last edited:
I put the file "afxres.h" in the folder Microsoft SDKs

1>------ Inizio compilazione: Progetto: Atlantis, Configurazione: Release Win32 ------
2>------ Inizio compilazione: Progetto: AtlantisConfig, Configurazione: Release Win32 ------
2>C:\Programmi\Microsoft SDKs\Windows\v7.0A\include\afxres.h(8): fatal error RC1004: unexpected end of file found
2>
1>afxres.h(8): fatal error RC1004: unexpected end of file found
1>
========== Compilazione: 0 completate, 2 non riuscite, 2 aggiornate, 0 ignorate ==========

I use Visual C++ 2010 express
 
Last edited:
Add a new empty line (press enter after the last line) at the end of file.
 
Back
Top