Ошибка rc1015 cannot open include file afxres h

I’m trying to compile an old project using VS express 2010 but I get this error:

fatal error RC1015: cannot open include file ‘afxres.h’. from this code

/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

I have installed Windows SDK already, but without any success.

thanks!

Mathieu Renda's user avatar

asked Aug 25, 2010 at 12:57

clamp's user avatar

This header is a part of the MFC Library. VS Express edition doesn’t contain MFC. If your project doesn’t use MFC you can safely replace afxres.h with windows.h in your terrain2.rc.

answered Aug 25, 2010 at 13:03

Kirill V. Lyadvinsky's user avatar

4

Had the same problem . Fixed it by installing Microsoft Foundation Classes for C++.

  1. Start
  2. Change or remove program (type)
  3. Microsoft Visual Studio
  4. Modify
  5. Select ‘Microsoft Foundation Classes for C++’
  6. Update

enter image description here

In in the Visual Studio Installer for VS 2022 this may be listed as an individual component: «C++ MFC for latest v143 build Tools (x86 & x64)», but you may need to adapt this for your platform and latest version available.

Stephen Turner's user avatar

answered Jul 23, 2013 at 10:47

Colonel Panic's user avatar

Colonel PanicColonel Panic

133k89 gold badges401 silver badges465 bronze badges

1

Even I too faced similar issue,

fatal error RC1015: cannot open include file ‘afxres.h’. from this code

Replacing afxres.h with Winresrc.h and declaring IDC_STATIC as -1 worked for me.
(Using visual studio Premium 2012)

//#include "afxres.h"
#include "WinResrc.h"
#define IDC_STATIC  -1

answered Jul 3, 2013 at 17:22

ravi.zombie's user avatar

ravi.zombieravi.zombie

1,4821 gold badge20 silver badges23 bronze badges

1

Alternatively you can create your own afxres.h:

#ifndef _AFXRES_H
#define _AFXRES_H
#if __GNUC__ >= 3
#pragma GCC system_header
#endif

#ifdef __cplusplus
extern "C" {
#endif

#ifndef _WINDOWS_H
#include <windows.h>
#endif

/* IDC_STATIC is documented in winuser.h, but not defined. */
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif

#ifdef __cplusplus
}
#endif
#endif   

answered Sep 12, 2014 at 13:45

Gerben's user avatar

GerbenGerben

1611 silver badge2 bronze badges

0

You can also try replace afxres.h with WinResrc.h

answered Oct 1, 2012 at 12:20

Irbis's user avatar

IrbisIrbis

11.6k6 gold badges39 silver badges68 bronze badges

1

managed to fix this by copying the below folder from another Visual Studio setup (non-express)

from
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc

to
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc

answered Jan 10, 2015 at 14:05

Tiago Duarte's user avatar

Tiago DuarteTiago Duarte

3,2643 gold badges23 silver badges29 bronze badges

a similar issue is for Visual studio 2015 RC.
Sometimes it loses the ability to open RC: you double click but editor do not one menus and dialogs.

Right click on the file *.rc, it will open:

enter image description here

And change as following:

enter image description here

answered Jun 6, 2015 at 19:55

ingconti's user avatar

ingcontiingconti

10.9k3 gold badges62 silver badges49 bronze badges

0

I faced same issue on VS 2019. My solution was to install C++ MFC library from Individual Components tab. When you open Visual Studio go to Tools->GetToolsAndFeatures->IndividualComponents

Select and install:

  • MSVC v142 — VS 2019 C++ x64/x86 build tools (Latest)
  • C++ ATL for latest v142 build tools (x86 & x64)
  • C++ MFC for latest v142 build tools (x86 & x64)

answered Jun 22, 2022 at 23:38

Darko V's user avatar

Darko VDarko V

491 silver badge5 bronze badges

Had similar issue but the message was shown when I tried to open a project solution. What worked for me was:

TOOLS -> Import and Export Settings…-> Reset all settings

answered Oct 7, 2015 at 8:11

Olppah's user avatar

OlppahOlppah

7891 gold badge10 silver badges21 bronze badges

I’m trying to compile an old project using VS express 2010 but I get this error:

fatal error RC1015: cannot open include file ‘afxres.h’. from this code

/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

I have installed Windows SDK already, but without any success.

thanks!

Mathieu Renda's user avatar

asked Aug 25, 2010 at 12:57

clamp's user avatar

This header is a part of the MFC Library. VS Express edition doesn’t contain MFC. If your project doesn’t use MFC you can safely replace afxres.h with windows.h in your terrain2.rc.

answered Aug 25, 2010 at 13:03

Kirill V. Lyadvinsky's user avatar

4

Had the same problem . Fixed it by installing Microsoft Foundation Classes for C++.

  1. Start
  2. Change or remove program (type)
  3. Microsoft Visual Studio
  4. Modify
  5. Select ‘Microsoft Foundation Classes for C++’
  6. Update

enter image description here

In in the Visual Studio Installer for VS 2022 this may be listed as an individual component: «C++ MFC for latest v143 build Tools (x86 & x64)», but you may need to adapt this for your platform and latest version available.

Stephen Turner's user avatar

answered Jul 23, 2013 at 10:47

Colonel Panic's user avatar

Colonel PanicColonel Panic

133k89 gold badges401 silver badges465 bronze badges

1

Even I too faced similar issue,

fatal error RC1015: cannot open include file ‘afxres.h’. from this code

Replacing afxres.h with Winresrc.h and declaring IDC_STATIC as -1 worked for me.
(Using visual studio Premium 2012)

//#include "afxres.h"
#include "WinResrc.h"
#define IDC_STATIC  -1

answered Jul 3, 2013 at 17:22

ravi.zombie's user avatar

ravi.zombieravi.zombie

1,4821 gold badge20 silver badges23 bronze badges

1

Alternatively you can create your own afxres.h:

#ifndef _AFXRES_H
#define _AFXRES_H
#if __GNUC__ >= 3
#pragma GCC system_header
#endif

#ifdef __cplusplus
extern "C" {
#endif

#ifndef _WINDOWS_H
#include <windows.h>
#endif

/* IDC_STATIC is documented in winuser.h, but not defined. */
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif

#ifdef __cplusplus
}
#endif
#endif   

answered Sep 12, 2014 at 13:45

Gerben's user avatar

GerbenGerben

1611 silver badge2 bronze badges

0

You can also try replace afxres.h with WinResrc.h

answered Oct 1, 2012 at 12:20

Irbis's user avatar

IrbisIrbis

11.6k6 gold badges39 silver badges68 bronze badges

1

managed to fix this by copying the below folder from another Visual Studio setup (non-express)

from
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc

to
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc

answered Jan 10, 2015 at 14:05

Tiago Duarte's user avatar

Tiago DuarteTiago Duarte

3,2643 gold badges23 silver badges29 bronze badges

a similar issue is for Visual studio 2015 RC.
Sometimes it loses the ability to open RC: you double click but editor do not one menus and dialogs.

Right click on the file *.rc, it will open:

enter image description here

And change as following:

enter image description here

answered Jun 6, 2015 at 19:55

ingconti's user avatar

ingcontiingconti

10.9k3 gold badges62 silver badges49 bronze badges

0

I faced same issue on VS 2019. My solution was to install C++ MFC library from Individual Components tab. When you open Visual Studio go to Tools->GetToolsAndFeatures->IndividualComponents

Select and install:

  • MSVC v142 — VS 2019 C++ x64/x86 build tools (Latest)
  • C++ ATL for latest v142 build tools (x86 & x64)
  • C++ MFC for latest v142 build tools (x86 & x64)

answered Jun 22, 2022 at 23:38

Darko V's user avatar

Darko VDarko V

491 silver badge5 bronze badges

Had similar issue but the message was shown when I tried to open a project solution. What worked for me was:

TOOLS -> Import and Export Settings…-> Reset all settings

answered Oct 7, 2015 at 8:11

Olppah's user avatar

OlppahOlppah

7891 gold badge10 silver badges21 bronze badges

Description

I am having an issue building an Azure Devops Pipeline. We have an msbuild step that builds a collection of solutions. I am experiencing an error with both the 2019 and 2022 vmImage.

I have seen: #3957 which I would think addresses the issue but there seems to still be an issue from the Resource Compiler side of things.

Virtual environments affected

  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10.15
  • macOS 11
  • Windows Server 2016
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

Environment: windows-2022
Version: 20220316.1
Included Software: https://github.com/actions/virtual-environments/blob/win22/20220316.1/images/win/Windows2022-Readme.md
Image Release: https://github.com/actions/virtual-environments/releases/tag/win22%2F20220316.1

Is it regression?

No response

Expected behavior

Resource Compiler should exit with no error. (C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86\rc.exe /l»0x0409″ /ID:\a\1\s\src\MyProject\inc /nologo /fo»obj\Debug\MyProject.res» Resources\MyProject.rc)

Actual behavior

Error RC1015: cannot open include file ‘afxres.h’

Repro steps

Add a resource (rc) file to a build that has an #include statement for afxres.h.

Hello,

I recently had to reinstall my Visual Studio 2008 standard edition and Intel(R) Visual Fortran Compiler XE 13.1.0.149 [IA-32]. A copy of Help|About is given below.

Now, although the Visual Studio integration seems to be OK (See the data from Tools|Intel Composer XE|Visual Fortran|Compilers given below), I get the following errors when building from the IDE:

fatal error RC1015: cannot open include file ‘afxres.h’, when trying to compile resources, and

error #10037: could not find ‘link’, when trying to build existing applications

It seems that somehow $(VSInstallDir) and $(VCInstallDir) do not resolve to VS and VC install folders. ‘afxres.h’ and ‘link.exe’ are available under  $(VCInstallDir)atlmfc\include resp. $(VCInstallDir)BIN

I have uninstalled and reinstalled several times (actually spend the entire weekend trying to find a solution), but without result.

I hope someone has a solution for this issue.

kind regards,

Walter Kramer

  • Executables: $(IFortInstallDir)bin\ia32;$(VSInstallDir)Common7\IDE;$(VCInstallDir)BIN;$(VSInstallDir)Common7\Tools;$(VSInstallDir)Common7\Tools\bin;$(FrameworkDir)$(FrameworkVersion);$(WindowsSdkDir)bin;$(PATH)
  • Libraries: $(IFortInstallDir)compiler\lib\ia32;$(IFortInstallDir)mkl\lib\ia32;$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)lib;
  • Includes: $(IFortInstallDir)compiler\include;$(IFortInstallDir)compiler\include\ia32;$(IFortInstallDir)mkl\include;$(VCInstallDir)atlmfc\include;$(VCInstallDir)include;$(WindowsSdkDir)include;$(FrameworkSDKDir)include

Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1

Installed Edition: Standard

Microsoft Visual Basic 2008   91851-136-2607274-60684
Microsoft Visual Basic 2008

Microsoft Visual C# 2008   91851-136-2607274-60684
Microsoft Visual C# 2008

Microsoft Visual C++ 2008   91851-136-2607274-60684
Microsoft Visual C++ 2008

Microsoft Visual Web Developer 2008   91851-136-2607274-60684
Microsoft Visual Web Developer 2008

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB2538241)   KB2538241
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2538241.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB944899)   KB944899
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/944899.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB945282)   KB945282
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/945282.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB946040)   KB946040
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946040.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB946308)   KB946308
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946308.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB946344)   KB946344
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946344.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB946581)   KB946581
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946581.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB947173)   KB947173
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947173.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB947540)   KB947540
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947540.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB947789)   KB947789
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947789.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB948127)   KB948127
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/948127.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB953256)   KB953256
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/953256.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB971091)   KB971091
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/971091.

Hotfix for Microsoft Visual Studio 2008 Standard Edition — ENU (KB971092)   KB971092
This hotfix is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/971092.

Intel(R) Visual Fortran     Package ID: w_fcompxe_2013.2.149
Intel(R) Visual Fortran Composer XE 2013 Update 2 Integration for Microsoft Visual Studio* 2008, 13.0.3615.2008, Copyright (C) 2002-2013 Intel Corporation
* Other names and brands may be claimed as the property of others.

Microsoft Visual Studio 2008 Standard Edition — ENU Service Pack 1 (KB945140)   KB945140
This service pack is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this service pack will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/945140.

Microsoft Visual Studio 2008 Standard Edition — ENU Service Pack 1 (KB947888)   KB947888
This service pack is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this service pack will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947888.

Microsoft Visual Studio 2008 Standard Edition — ENU Service Pack 1 (KB948484)   KB948484
This service pack is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this service pack will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/948484.

Security Update for Microsoft Visual Studio 2008 Standard Edition — ENU (KB2251487)   KB2251487
This security update is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this security update will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2251487.

Security Update for Microsoft Visual Studio 2008 Standard Edition — ENU (KB2669970)   KB2669970
This security update is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this security update will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/2669970.

Update for Microsoft Visual Studio 2008 Standard Edition — ENU (KB956453)   KB956453
This update is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this update will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/956453.

Update for Microsoft Visual Studio 2008 Standard Edition — ENU (KB967143)   KB967143
This update is for Microsoft Visual Studio 2008 Standard Edition — ENU.
If you later install a more recent service pack, this update will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/967143.

I’m trying to compile an old project using VS express 2010 but I get this error:

fatal error RC1015: cannot open include file ‘afxres.h’. from this code

/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

I have installed Windows SDK already, but without any success.

thanks!

Mathieu Renda's user avatar

asked Aug 25, 2010 at 12:57

clamp's user avatar

This header is a part of the MFC Library. VS Express edition doesn’t contain MFC. If your project doesn’t use MFC you can safely replace afxres.h with windows.h in your terrain2.rc.

answered Aug 25, 2010 at 13:03

Kirill V. Lyadvinsky's user avatar

4

Had the same problem . Fixed it by installing Microsoft Foundation Classes for C++.

  1. Start
  2. Change or remove program (type)
  3. Microsoft Visual Studio
  4. Modify
  5. Select ‘Microsoft Foundation Classes for C++’
  6. Update

enter image description here

In in the Visual Studio Installer for VS 2022 this may be listed as an individual component: «C++ MFC for latest v143 build Tools (x86 & x64)», but you may need to adapt this for your platform and latest version available.

Stephen Turner's user avatar

answered Jul 23, 2013 at 10:47

Colonel Panic's user avatar

Colonel PanicColonel Panic

132k85 gold badges399 silver badges462 bronze badges

1

Even I too faced similar issue,

fatal error RC1015: cannot open include file ‘afxres.h’. from this code

Replacing afxres.h with Winresrc.h and declaring IDC_STATIC as -1 worked for me.
(Using visual studio Premium 2012)

//#include "afxres.h"
#include "WinResrc.h"
#define IDC_STATIC  -1

answered Jul 3, 2013 at 17:22

ravi.zombie's user avatar

ravi.zombieravi.zombie

1,4721 gold badge20 silver badges23 bronze badges

1

Alternatively you can create your own afxres.h:

#ifndef _AFXRES_H
#define _AFXRES_H
#if __GNUC__ >= 3
#pragma GCC system_header
#endif

#ifdef __cplusplus
extern "C" {
#endif

#ifndef _WINDOWS_H
#include <windows.h>
#endif

/* IDC_STATIC is documented in winuser.h, but not defined. */
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif

#ifdef __cplusplus
}
#endif
#endif   

answered Sep 12, 2014 at 13:45

Gerben's user avatar

GerbenGerben

1611 silver badge2 bronze badges

0

You can also try replace afxres.h with WinResrc.h

answered Oct 1, 2012 at 12:20

Irbis's user avatar

IrbisIrbis

11.3k6 gold badges38 silver badges64 bronze badges

1

managed to fix this by copying the below folder from another Visual Studio setup (non-express)

from
C:Program Files (x86)Microsoft Visual Studio 12.0VCatlmfc

to
C:Program Files (x86)Microsoft Visual Studio 11.0VCatlmfc

answered Jan 10, 2015 at 14:05

Tiago Duarte's user avatar

Tiago DuarteTiago Duarte

3,2243 gold badges23 silver badges28 bronze badges

a similar issue is for Visual studio 2015 RC.
Sometimes it loses the ability to open RC: you double click but editor do not one menus and dialogs.

Right click on the file *.rc, it will open:

enter image description here

And change as following:

enter image description here

answered Jun 6, 2015 at 19:55

ingconti's user avatar

ingcontiingconti

10.8k3 gold badges61 silver badges47 bronze badges

0

I faced same issue on VS 2019. My solution was to install C++ MFC library from Individual Components tab. When you open Visual Studio go to Tools->GetToolsAndFeatures->IndividualComponents

Select and install:

  • MSVC v142 — VS 2019 C++ x64/x86 build tools (Latest)
  • C++ ATL for latest v142 build tools (x86 & x64)
  • C++ MFC for latest v142 build tools (x86 & x64)

answered Jun 22, 2022 at 23:38

Darko V's user avatar

Darko VDarko V

491 silver badge5 bronze badges

Had similar issue but the message was shown when I tried to open a project solution. What worked for me was:

TOOLS -> Import and Export Settings…-> Reset all settings

answered Oct 7, 2015 at 8:11

Olppah's user avatar

OlppahOlppah

7611 gold badge10 silver badges21 bronze badges

  • Remove From My Forums
  • Question

  • Hi Folks:

       Last night, while trying to get VS 2015 to use the Windows 10 SDK, I managed to mess up the IDE to the point where a fresh install sounded like a good idea. 

       I went to MS’s VS Community site for the latest download.  2017 is now the default offered version, so I downloaded and installed it.

       The compilation failed.  The only error found is in the .RC file: 

    /////////////////////////////////////////////////////////////////////////////
    //
    // Generated from the TEXTINCLUDE 2 resource.
    //
    #include "afxres.h"

       Nothing was found when I searched for the header file on the C: drive. 

       Commenting out the include caused other errors. 

       Suggestions?

          Thanks
          Larry

    • Edited by

      Tuesday, March 14, 2017 11:50 PM

Answers

  • Hi,

    thanks for posting here.

    >>VS 2017 .RC file — Error RC1015 cannot open include file ‘afxres.h’

    For this case, I suggest you check if you have installed vc++ feature especially the MFC support with vs2017.

    If not, please modify your vs2017 and add these features.

    Hope this could be help of you.

    Best Regards,
    Sera Yu


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by
      a_unique_name
      Wednesday, March 15, 2017 10:34 AM
##[error]OldWindowsAppOldWindowsApp.rc(10,0): Error RC1015: cannot open include file 'afxres.h'.

Upon further investigation, changing the platform version from v142 to v143 will fix the build issue. Older applications that don’t seem to be MFC library dependent still depend on artifacts like afxres.h and afxres.rc.

It does seem on the windows 2022 image that MSVC v142 is installed. Therefore my expectation would be that C++ MFC for v142 would also be installed (which I believe is the package in Visual Studio that would fix this issue).

  • Remove From My Forums
  • Question

  • I am trying to compile samurize plugin for T-Balancer: http://www.samurize.com/modules/mydownloads/visit.php?cid=6&lid=1897 and whatever I do I receive message from the subject.


    I followed «Using Visual C++ 2005 Express Edition with the Microsoft Platform SDK» and it did not help.


    I have read
    somewhere that problem can be related to too long paths. Even so I have no idea how to make them shorter. Also information that ‘afxres.h‘ is related to MFC does not help.


    I just want to compile some examples and every second attempt ends up with that very annoying message.

Answers

  • Solved and in case if anybody is interested:

    After Microsoft Platform SDK is installed its /include folder consists subfolder /mfc. All necessary files seem to be there. Microsoft’s instruction: «Using Visual C++ 2005 Express Edition with the Microsoft Platform SDK» explains that following line: «C:Program FilesMicrosoft Platform SDKinclude» must be added to «the Visual C++ directories in the Projects and Solutions section in the Options dialog box». But does not say anything about line: «C:Program FilesMicrosoft Platform SDKincludemfc». Add it as well what, hopefully, will solve problems.

При компиляции проекта произошла следующая ошибка:

error RC1015: cannot open include file ‘afxres.h’.

Файл afxres.h относится к MFC. Есть два решения этой ошибки:

способ 1:

Проект-> Свойства-> Каталог VC ++-> Включить каталог, добавить D: VS VS2012 VC atlmfc include, как показано на рисунке, добавить путь как путь установки VS VC atlmfc include, добавить правильно, как показано на рисунке ниже Покажи, перекомпилируй проект и все получится.

Способ 2:

1. Войдите в режим обслуживания VS и установите MFC. Достаточно много времени. (Не рекомендуется)

2. Если ваш код вообще не использует MFC, просто добавьте

#Include «afxres.h» Изменить на

         #include <Windows.h>
         #include <winres.h>

Как показано ниже, перекомпилируйте проект, и он будет успешным.

Ссылка для справки:

https://stackoverflow.com/questions/3566018/cannot-open-include-file-afxres-h-in-vc2010-express

Понравилась статья? Поделить с друзьями:
  • Ошибка rangeerror maximum call stack size exceeded
  • Ошибка rbus замыкание на массу
  • Ошибка po441 шкода
  • Ошибка rbs аутлендер гибрид
  • Ошибка po420 ford фокус