如何在 Eclipse 中指定预处理器指令?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3747147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to specify a preprocessor directive in eclipse?
提问by Adam
How are preprocessor directives specified in eclipse for different configurations? For instance if I have multiple mains that should be run in different configurations and specify
eclipse中如何为不同的配置指定预处理器指令?例如,如果我有多个主电源应该在不同的配置中运行并指定
#ifdef Problem1
//main func
#endif /*Problem1*/
Note that this is with managed makefiles
请注意,这是与托管生成文件
回答by Georg Fritzsche
The documentationpoints to "C/C++ Project Properties"→ "Paths and Symbols"→ "Symbols".
该文档指向“C/C++ 项目属性”→ “路径和符号”→ “符号”。
However, usually it is better to use different source files for different configurations/architectures/... instead of extensive preprocessor usage.
但是,通常最好为不同的配置/架构/...使用不同的源文件,而不是大量使用预处理器。