windowsresourcesversioninfoafxrc.exe

Do I need afxres.h, if I am not using MFC? How do I remove it from the .RC script?


I don't know RC scripts.

I want to include Product version, File version, etc. metadata into a DLL I'm building. I'm using an .rc file to do that. The build is makefile driven. I'm following along with an example .rc scrpit I found.

The template .rc file includes afxres.h , but I don't think I need that. But if I just remove it I get a bunch of compile errors.

What does a basic, non-MFC RC script look like? Can I remove all the stuff like this:

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

....

Solution

  • My answer:
    NO, I don't need all that crap. Here's an RC script that works for VERSIONINFO.

    #define VER_FILEVERSION          1,2,3,4
    #define VER_FILEVERSION_STR      "1.2.3.4"
    #define VER_PRODUCTVERSION       1,2,0,0
    #define VER_PRODUCTVERSION_STR   "1.2.0.0"
    
    // -------------------------------------------------------
    
    VS_VERSION_INFO VERSIONINFO
     FILEVERSION            VER_FILEVERSION
     PRODUCTVERSION         VER_PRODUCTVERSION
     FILEFLAGSMASK 0x17L
    #ifdef _DEBUG
     FILEFLAGS 0x1L
    #else
     FILEFLAGS 0x0L
    #endif
     FILEOS 0x4L
     FILETYPE 0x2L
     FILESUBTYPE 0x0L
    BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
        VALUE "CompanyName",      "Company X"
        VALUE "FileDescription",  "Description Goes Here"
        VALUE "InternalName",     "NotSure"
        VALUE "LegalCopyright",   "Copyright (C) 2009 Your Name Here"
        VALUE "OriginalFilename", "DllName.dll"
        VALUE "ProductName",      "Product Title"
        VALUE "FileVersion",      VER_FILEVERSION_STR
        VALUE "ProductVersion",   VER_PRODUCTVERSION_STR
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
    END
    

    Conmpile it with:

    $(WindowsSDK)\bin\RC.exe /FoProjectName.res ProjectName.rc