Visual Studio 2005. RC File includes

前端 未结 5 463
日久生厌
日久生厌 2021-01-11 23:31

I\'m programming in C++ on Visual Studio 2005. My question deals with .rc files. You can manually place include directives like (#include \"blah.h\"), at the top of an .rc

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-12 00:07

    Add your #include to the file in the normal way, but also add it to one the three "TEXTINCLUDE" sections in the file, like so:

    2 TEXTINCLUDE
    BEGIN
        "#include ""windows.h""\r\n"
         "#include ""blah.h\r\n"
         "\0"
     END
    

    Note the following details:

    • Each line is contained in quotes
    • Use pairs of quotes, e.g., "" to place a quote character inline
    • End each line with \r\n
    • End the TEXTINCLUDE block with "\0"

    Statements placed in the "1 TEXTINCLUDE" block will be written to the beginning of the .rc file when the file is re-written by the resource editor. Statements placed in the 2 and 3 blocks follow, so you can guarantee relative include file order by using the appropriately numbered block.

    If your existing rc file does not already include TEXTINCLUDE blocks, use the new file wizard from the Solution Explorer pane to add a new rc file, then use that as a template.

提交回复
热议问题