如何在Makefile中定义C ++预处理器变量 [英] How to define C++ preprocessor variable in Makefile
本文介绍了如何在Makefile中定义C ++预处理器变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个像这样的C ++预处理器:
#ifdef cpp_variable
// x + y;
#endif
请任何人告诉我如何在Makefile中定义。
感谢!
解决方案
您不能在Makefile中执行此操作。但是,可以在调用编译器时执行此操作。
例如对于 g ++
,语法是:
g ++ -Dcpp_variable< other stuff>
I have a C++ preprocessor written like this:
#ifdef cpp_variable
//x+y;
#endif
please anyone tell me how to define this in Makefile.
thanks!
解决方案
You can't do this in a Makefile. However, you can do this when calling the compiler. Search your compiler documentation to find how to do that.
For example for g++
the syntax is :
g++ -Dcpp_variable <other stuff>
这篇关于如何在Makefile中定义C ++预处理器变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文