Monday, February 17, 2020

resource file building in Visual C++ projects

some issues fix on building menu resource file.

#include afxres.h or #include windows.h can fix this issue in resource file definition.

  1. error RC2104: undefined keyword or key name: DS_SETFONT
  2. http://www.winprog.org/tutorial/errors.html
    1. Error LNK2001: unresolved external symbol _main
    2. Error C2440: cannot convert from 'void*' to 'HICON__ *' (or similar)
    3. Fatal error RC1015: cannot open include file 'afxres.h'
    4. Error LNK2001: unresolved external symbol InitCommonControls
    5. Dialog does not display when certain controls are added

  3. Resource Compiler Error RC2104
  4. error RC2104 : undefined keyword or key name: ID_FILE_MRU_FILE1 in my .rc file
  5. Thread: error RC2104 : undefined keyword or key name
  6. Ошбика undefined keyword or key name: WS

  7. fatal error RC1015: cannot open include file 'afxres.h'
  8. the answer is:

    Or, if you don't want to install MFC, you can replace the line: #include "afxres.h" with: #include

  9. VS 2017 .RC file - Error RC1015 cannot open include file 'afxres.h'
  10. In the newest version of Visual Studio 2017 this seems to have been separated into two components that needs to be installed. 1)Visual C++ ATL for x86 and x64 2)Visual C++ MFC for x86 and x64

    Tools -> Get Tools and Features... will list what components are installed and allow for adding and removing of components.

  11. Cannot open include file 'afxres.h' in VC2010 Express
  12. answerThis 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.

    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

    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 #endif /* IDC_STATIC is documented in winuser.h, but not defined. */ #ifndef IDC_STATIC #define IDC_STATIC (-1) #endif #ifdef __cplusplus } #endif


No comments:

Post a Comment