问题描述
有没有办法在全球范围内声明的#define?
Is there a way to globally declare a #define?
就像我希望有一个具有比如一个文件,
Like I want to have a file that has for instance,
#define MONO
和我想所有的源代码文件,要知道,这预处理器指令定义。我将如何做到这一点。
and I want all source-code files to know that this pre-processor directive is defined. How would I achieve that?
推荐答案
更新:你不能做一个解决方案范围的定义据我所知,然而答案下面是可行的对每个项目的基础。
Update: You cannot do a "solution-wide" define afaik, however the answer below is workable on a per-project basis.
您设置它们在你的编译属性或构建选项:
You set them in your Compilation Properties or Build options:
的(VS2008)
(VS2010)
http://msdn.microsoft.com/en-US/library/76zdzba1(v=VS.80).aspx (VS2008)http://msdn.microsoft.com/en-US/library/76zdzba1(v=VS.100).aspx (VS2010)
看到要设置自定义常量标题
see the "To set a custom constant" heading.
更新
的
您得到通过右键单击该项目,并从菜单中选择属性生成选项
You get to the build options by right-clicking the project and selecting properties from the menu.
这篇关于解决方案范围内的#define的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!