Ошибка 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

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 badges39 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 badges48 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.

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)atlmfcinclude 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)binia32;$(VSInstallDir)Common7IDE;$(VCInstallDir)BIN;$(VSInstallDir)Common7Tools;$(VSInstallDir)Common7Toolsbin;$(FrameworkDir)$(FrameworkVersion);$(WindowsSdkDir)bin;$(PATH)
  • Libraries: $(IFortInstallDir)compilerlibia32;$(IFortInstallDir)mkllibia32;$(VCInstallDir)atlmfclib;$(VCInstallDir)lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)lib;
  • Includes: $(IFortInstallDir)compilerinclude;$(IFortInstallDir)compilerincludeia32;$(IFortInstallDir)mklinclude;$(VCInstallDir)atlmfcinclude;$(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.

Понравилась статья? Поделить с друзьями:
  • Ошибка razer synapse failed to start
  • Ошибка ran time error samp
  • Ошибка ran out of memory allocating
  • Ошибка ram диск заполнен или не включен
  • Ошибка rainbow six siege unable to find