Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

conditional compilation .rc file does not work

932 views
Skip to first unread message

sree...@gmail.com

unread,
Apr 6, 2009, 10:42:30 AM4/6/09
to
Hi

I would like to have a version displayed as 6.4.xxx in 64bit build and
6.3.xxx in 32bit built using the same .rc file. Here is the code

#ifdef BUILD64
#define IDD_OPTION_TITLE "6.40.119"
#else
#define IDD_OPTION_TITLE "6.30.119"
#endif

I have defined BUILD64 only in x64 build in VS2008. But both in 32 and
64bit builds i see the version as 6.30.xxx. I changed BUILD64
definition to _AMD64 .. defined in VS. But that does not help. Does
coditional compilation not working in .rc file?

Sreenidhi

David Wilkinson

unread,
Apr 6, 2009, 1:21:49 PM4/6/09
to
Sre wrote:
> Hi
>
> I would like to have the version displayed as 6.4.xxx in 64bit build and
> 6.3.xxx in 32bit built using the same .rc file. Here is the code
>
> #ifdef BUILD64
> #define IDD_OPTION_TITLE "6.40.119"
> #else
> #define IDD_OPTION_TITLE "6.30.119"
> #endif
>
> I using IDD_OPTION_TITLE in diaglog title. I have defined BUILD64 only in
> x64 build in VS2008. But both in 32 and 64bit builds i see the version as
> 6.30.xxx. I changed BUILD64 definition to _AMD64 .. defined in VS. But that
> does not help. Does
> coditional compilation not working in .rc file? I tried putting #ifdefs in
> .rc2 file and including in .rc file. Even that does not work.

You do know that the preprocessor symbols for the resources are defined
separately from those of the compiler? [Exactly why, I have never been sure.]

--
David Wilkinson
Visual C++ MVP

Joseph M. Newcomer

unread,
Apr 6, 2009, 1:49:36 PM4/6/09
to
See below...

****
Because it is a separate tool, run from a separate command line (CreateProcess call)? Does
not seem unreasonable that there might be a desire to have various settings.
joe
****
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

sree...@gmail.com

unread,
Apr 7, 2009, 2:16:09 AM4/7/09
to
Need to define preprocessor defines separately for .rc file.

1. Open your project in Visual Studio 2008
2. Right click on resource script file (e.g. app.rc) and select
"Properties"
3. At the top of the property page, select one platform like "Win32"
or
"x64".
4. In the left menu bar, select [Configuration Properties] /
[Resources] /
[General].
5. In the "Preprocessor Definitions" field, add "WIN32" for "Win32"
platform and "WIN64" for "x64" platform. The field value will become
"
WINXX;_UNICODE;UNICODE". (XX will be 32 or 64)
6. Click OK to close the window.
7. Right click on resource script file (e.g. app.rc) and select "View
Code".
8. In the code editor, add #ifdef and #elif to conditionally include
resources when compiling. Use "WIN32" and "WIN64" preprocessor
definitions
that we defined just now. Here is a sample code:

This is posted in
http://www.dotnetmonster.com/Uwe/Forum.aspx/vs-net-general/12537/Resource-Compiler-distinction-x64-or-x86

Sree

> email: newco...@flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm- Hide quoted text -
>
> - Show quoted text -

Sre

unread,
Apr 7, 2009, 2:19:01 AM4/7/09
to
Need to define preprocessor defines separately for .rc file.

1. Open your project in Visual Studio 2008
2. Right click on resource script file (e.g. app.rc) and select "Properties"
3. At the top of the property page, select one platform like "Win32" or
"x64".
4. In the left menu bar, select [Configuration Properties] / [Resources] /
[General].
5. In the "Preprocessor Definitions" field, add "WIN32" for "Win32"
platform and "WIN64" for "x64" platform. The field value will become "
WINXX;_UNICODE;UNICODE". (XX will be 32 or 64)
6. Click OK to close the window.
7. Right click on resource script file (e.g. app.rc) and select "View Code".
8. In the code editor, add #ifdef and #elif to conditionally include
resources when compiling. Use "WIN32" and "WIN64" preprocessor definitions
that we defined just now. Here is a sample code:

Sree

0 new messages