本文是小编为大家收集整理的关于Visual Studio C++项目中的环境变量是如何/在哪里设置的?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。
问题描述
我的项目属性中有很多环境变量我不了解.单击宏(是否有视觉录音室环境变量列表? )给了我他们的价值清单,但我无法弄清楚其中一些设置的位置. 例如,我试图弄清楚变量$(IntDir)的设置.
哪些文件负责设置这些变量?我该如何修改它们?
推荐答案
这些不是环境变量.
它们只是由构建系统定义的宏,您可以用于为项目设置构建属性.它们会自动扩展到目标平台($(Platform)),为您的项目存储中间文件的路径($(IntDir))以及您的项目名称($(ProjectName)).
您不能直接更改它们,但是可以通过修改项目的属性来更改它们.项目文件(创建新项目时,由Visual Studio自动创建)负责设置它们.
您已经找到了'em 的大列表,这有助于解释它们是什么和做什么.正如文档所说,您可以在项目的属性页面中使用它们的任何地方使用字符串值的任何地方.它们使您不必到硬码路径和其他信息,这非常有用.
与环境变量不同,它们没有持续存在或具有与您的构建系统无关的意义.建立项目后,它们就会消失.它们在调试或部署期间未使用.
其他推荐答案
. >这个答案有帮助. (基本上,您可以使用Process Explorer查找.)
问题描述
There a lots of environment variables in my project properties that I do not understand. Clicking on macros (Is there a list of Visual Studio environment variables?) gives me a list of their values, but I am unable to figure out where some of these are set. For example, I am trying to figure out where the variable $(IntDir) is being set.
What file is responsible for setting these variables? How can I modify them?
推荐答案
These are not environment variables.
They're just macros defined by the build system that you can use for setting build properties for your project. They automatically expand to things like the target platform ($(Platform)), the path to store intermediate files for your project ($(IntDir)), and the name of your project ($(ProjectName)).
You can't change them directly, but you can change them by modifying your project's properties. The project file (created automatically by Visual Studio when you create a new project) is responsible for setting them.
You already found a link to the big list of 'em, which is helpful in explaining what they are and what they do. As the documentation says, you can use them anywhere in your project's property pages that string values are accepted. They keep you from having to hard-code paths and other information, which is exceptionally useful.
Unlike environment variables, they do not persist or have any meaning independent of your build system. Once your project has been built, they go away. They're not used during debugging or deployment.
其他推荐答案
.If you want to see actual values for a specific VS instance for both 'standard' and 'custom', see if this answer helps. (Basically, you can use Process Explorer to find that out.)