rc资源文件的宏定义

遇到一个问题,我希望在 DEBUG模式下包含资源A, 在RELEASE模式下包含B

于是我在 rc文件中写道:

 #ifdef _DEBUG

.................A

#else

................B

#endif 编译后发现

_DEBUG 没有被定义.  

原因:  MS编译器中资源是单独编译的,

在Project + properties, Resources, General, Preprocessor definitions 中可以定义预定义变量,

我们只要在DEBUG模式下写入 _DEBUG就可以了. 详细的参考资料: http://forums.msdn.microsoft.com/zh-CN/vcgeneral/thread/9cdaa780-cc97-498b-815e-cf23c3f3b333/

其中写道:

VS2005 doesn't properly pass the preprocessor definitions for the resource compiler. 

It generates extra double-quotes, fatally confusing rc.exe. 

I got the httpd project to compile by specifying the command line options by hand: Project + properties, Resources, General, Preprocessor definitions = blankProject + properties,     

Project + properties,  Resources, General, Command line, Additional options = /d _DEBUG /d APP_FILE /d BIN_NAME="httpd.exe" /d LONG_NAME="Apache HTTP Server" /d ICON_FILE="apache.ico" /d _VC80_UPGRADE=0x0600

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值