我想添加条件以显示基于构建的特定布局/主题,例如:
我想为2个应用程序定义一个常量(包括调试和发布)
#IFDEF APP1.Debug
--- display layout 1
#IFDEF APP1.Release
--- display layout 2
#IFDEF APP2.Debug
--- display layout 3
#IFDEF APP2.Release
--- display layout 4
#ELSE
--- display layout 5
#ENDIF
如何在Visual Studio 2010中设置常量名称(上图)?他们如何在DEBUG和RElease下出现?
答案 0 :(得分:0)
这样的事情应该在MSVC下工作:
#if __PROJECT__ == "App1"
#ifdef _DEBUG
#define LAYOUT Value1
#else
#define LAYOUT Value2
#endif
#elif __PROJECT__ == "App2"
#ifdef _DEBUG
#define LAYOUT Value3
#else
#define LAYOUT Value4
#endif
#else
#define LAYOUT Value5
#endif