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

posted on   norsd  阅读(454)  评论(0编辑  收藏  举报

编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏

导航

< 2008年6月 >
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5
6 7 8 9 10 11 12
点击右上角即可分享
微信分享提示