我创建了一个包含以下内容的简单.xcconfig文件,并应用它:
GCC_PREPROCESSOR_DEFINITIONS[config=Debug] = FOODEBUG
GCC_PREPROCESSOR_DEFINITIONS[config=Release] = FOORELEASE
和包含主.cpp文件
#include <iostream>
// This warning IS shown
#if DEBUG
#warning DEBUG is set to 1
#endif
// This warning IS NOT shown
#ifdef FOODEBUG
#warning FOODEBUG is set
#endif
// This warning IS NOT shown
#ifdef FOORELEASE
#warning FOORELEASE is set
#endif
int main(int argc, const char * argv[])
{
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}
现在我想知道为什么main.cpp中FOODEBUG和FOORELEASE都没有定义?!
如预期的那样,构建设置显示了我的.xcconfig文件中的两行内容(“任何架构|任何SDK”),但实际上它们并没有被使用。
我该怎么做才能实现这个?