none
VS 2010 RC error RC4011

    Question

  • We have several projects that are generating a warning when compiling resources with VS 2010:

    c:\...\VC\Include\string.h(54) : warning RC4011: identifier truncated to '_CRT_SECURE_CPP_OVERLOAD_STANDA'

    There is a closed ("by design") bug report on this (https://connect.microsoft.com/VisualStudio/feedback/details/532929/rc4011-warnings-from-vc10-rc) that suggests that the solution if to put the #include <string.h> in a #ifndef _RC_INVOKED block. But we aren't including string.h; we're including some other necessary stuff (e.g., winnt.h and winuser.h), which must end up including string.h. Since RC.EXE apparently has no /showIncludes option like the compiler, we have no diagnostic tool to figure out how it's getting included and what to do.

    We need to fix this, since we have a "no warnings" build policy. Looking for any suggestions. (And why isn't everyone seeing this?)

    TIA

    Wednesday, April 21, 2010 1:16 PM

Answers

  • Well, resource files are usually autogenerated with an include of something which includes windows.h. If you want to use winnt.h or winuser.h then you should include windows.h instead since it will include both winnt.h and winuser.h. This will also automatically block out anything that it shouldn't be including.

    As a rule, if you need to include something from the Windows SDK, install the main windows.h and only add anything else if it isn't found after including that.

     


    Visit my (not very good) blog at http://c2kblog.blogspot.com/
    • Marked as answer by cdunford Wednesday, April 21, 2010 3:02 PM
    Wednesday, April 21, 2010 2:48 PM
  • Including winnt.h and winuser.h in .RC files isn't normal, so that's probably why everyone else isn't seeing it.

    That said, I'd be surprised if a Windows header triggered something to do with the CRT. I'd suspect another header than the ones you have mentioned, but I might be wrong.

    Anyway, do you really need to include all the things you're including in your .RC files? RC files usually just include resource.h (which is just a list of #defines for control identifiers in your dialogs, etc.) and afxres.h (which includes winres.h and is like a cut-down version of the windows headers).

     

    • Marked as answer by cdunford Wednesday, April 21, 2010 3:02 PM
    Wednesday, April 21, 2010 1:25 PM

All replies

  • Including winnt.h and winuser.h in .RC files isn't normal, so that's probably why everyone else isn't seeing it.

    That said, I'd be surprised if a Windows header triggered something to do with the CRT. I'd suspect another header than the ones you have mentioned, but I might be wrong.

    Anyway, do you really need to include all the things you're including in your .RC files? RC files usually just include resource.h (which is just a list of #defines for control identifiers in your dialogs, etc.) and afxres.h (which includes winres.h and is like a cut-down version of the windows headers).

     

    • Marked as answer by cdunford Wednesday, April 21, 2010 3:02 PM
    Wednesday, April 21, 2010 1:25 PM
  • Well, resource files are usually autogenerated with an include of something which includes windows.h. If you want to use winnt.h or winuser.h then you should include windows.h instead since it will include both winnt.h and winuser.h. This will also automatically block out anything that it shouldn't be including.

    As a rule, if you need to include something from the Windows SDK, install the main windows.h and only add anything else if it isn't found after including that.

     


    Visit my (not very good) blog at http://c2kblog.blogspot.com/
    • Marked as answer by cdunford Wednesday, April 21, 2010 3:02 PM
    Wednesday, April 21, 2010 2:48 PM
  • I don't know who originally included winuser.h/winnt.h, but including either afxres.h or windows.h instead solves the problem. Who knew.

    Thanks very much to both responders.

    Wednesday, April 21, 2010 3:02 PM
  • I've run in to a similar issue.  The problem I have is that in my .rc file I define dialogues with DIALOGEX that contain a STYLE statement.  The WS_* values are defined in winuser.h, so I'm at a loss as to how to correct the issue.  Any pointers would be greatly appreciated.
    • Proposed as answer by Chris Boorman Saturday, May 28, 2011 12:37 AM
    • Unproposed as answer by Chris Boorman Saturday, May 28, 2011 12:38 AM
    • Proposed as answer by IAmMartin Wednesday, July 30, 2014 10:02 AM
    • Unproposed as answer by IAmMartin Wednesday, July 30, 2014 10:02 AM
    Sunday, April 17, 2011 7:32 AM
  • I just ran into this issue, and I was able to solve it by rem'ing-out this line (in the resource.h file)

     

    //#include <winuser.h>
    

    and adding this one.

     

    #include <windows.h>
    

    —and it compiled without warnings.


    Outlook Mobile Programmer Writer
    Saturday, May 28, 2011 12:52 AM
  • I've got the same problem after converting a VS2008 project to VS2010.  In 'newres.h' I had:

    #ifdef RC_INVOKED
    #ifndef _INC_WINDOWS
    #define _INC_WINDOWS
     #include <winuser.h>           // Including that causes a warning.  Instead, we include the following:
    #endif
    #endif

    SOLUTION:

    #ifdef RC_INVOKED
    #ifndef _INC_WINDOWS
    #define _INC_WINDOWS
     #include <Windows.h>
     #include <Winuser.rh>
    #endif
    #endif

    Including only <Windows.h> was causing missing symbols (DS_FONT,....). 


    Simon le Lutin
    Friday, June 03, 2011 1:35 PM