如何/ Visual Studio C ++项目中的环境变量在哪里设置? [英] How/Where are the environment variables in a Visual Studio C++ project set?

查看:548
本文介绍了如何/ Visual Studio C ++项目中的环境变量在哪里设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目属性中有很多环境变量,我不明白。点击宏(是否有Visual Studio环境变量列表? )给出了他们的价值观列表,但是我无法确定其中的某些设置。
例如,我试图找出变量 $(IntDir)正在设置的位置。



什么文件负责设置这些变量?如何修改?

解决方案

这些不是环境变量。
$ b

它们只是由构建系统定义的宏,可以用于为项目设置构建属性。它们自动扩展到诸如目标平台( $(Platform))之类的东西,用于存储项目中间文件的路径( $(IntDir))和项目名称( $(ProjectName))。



你不能直接更改它们,但可以通过修改项目的属性来更改它们。项目文件(在创建新项目时由Visual Studio自动创建)负责设置它们。



您已经找到了'em 的大清单,这有助于解释他们是什么,他们做什么。如文档所述,您可以在项目的属性页面中的任何位置使用它们来接受字符串值。他们让你不必硬编码路径和其他信息,这是非常有用的。



与环境变量不同,它们不会与您的构建无关,也不具有任何意义系统。一旦你的项目建成,他们就会消失。在调试或部署期间不使用它们。


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.

这篇关于如何/ Visual Studio C ++项目中的环境变量在哪里设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆