How to include .rc file in another .rc file
I tried to use the following code to include a resource file in another resource file:
Code:
"
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""..\\..\\..\\common\\resources\\resource.h""\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#include ""..\\..\\..\\common\\resources\\commonEng.rc""\r\n"
"#endif\r\n"
"\0"
END
...
"
All included files are in the proper location. The resource was compiled successfully. But the .res didn't have resources that defined in the included resource file, commonEng.rc. What is problem here?
Thanks,
Re: How to include .rc file in another .rc file
Not sure if this will help, but try the following:
Code:
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""..\\..\\..\\common\\resources\\resource.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#include ""..\\..\\..\\common\\resources\\commonEng.rc"" //common rc\r\n"
"#endif\r\n"
"\0"
END
Good luck.
Re: How to include .rc file in another .rc file
Are the resources in your included .rc file in a different language? If they are, they will be ignored by the resource compiler.
You can tell what language your building for by checking your project settings in the "Resources" page.
Your .rc file will have a line like:
Code:
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
which is used to define what language the following resources are for.
Re: How to include .rc file in another .rc file
Thanks, krmed and Roger Allen.
Finally I found there should be another include line to repeatly include the same file. After I added that line, that is ok.
Thanks,