Windows 更改vs2010中的文件路径变量

Windows 更改vs2010中的文件路径变量,windows,visual-studio,visual-studio-2010,path,environment-variables,Windows,Visual Studio,Visual Studio 2010,Path,Environment Variables,我希望更改VS2010中的$(某物)变量。我一辈子都找不到这些$(某物)变量的定义 出于好奇,这是因为我正在编译libpng,需要更改$(ZLibSrcDir),所以它指向了我的zlib所在的位置。我知道我可以把它放在它期望的地方,但我仍然想知道如何更改这些变量。创建环境变量%ZLibSrcDir%指向您需要的地方 My Computer -> Properties -> Advanced -> Environment Variables 为什么不呢?创建环境变量%ZLibS

我希望更改VS2010中的
$(某物)
变量。我一辈子都找不到这些
$(某物)
变量的定义


出于好奇,这是因为我正在编译libpng,需要更改
$(ZLibSrcDir)
,所以它指向了我的zlib所在的位置。我知道我可以把它放在它期望的地方,但我仍然想知道如何更改这些变量。

创建环境变量
%ZLibSrcDir%
指向您需要的地方

My Computer -> Properties -> Advanced -> Environment Variables

为什么不呢?

创建环境变量
%ZLibSrcDir%
指向需要的地方

My Computer -> Properties -> Advanced -> Environment Variables

为什么不呢?

我想要的答案是编辑属性表。这是最新libpng源代码附带的属性表zlib.props。它与.sln文件位于同一文件夹中

<?xml version="1.0" encoding="utf-8"?>
<!--
 * zlib.props - location of zlib source
 *
 * libpng version 1.5.2 - March 31, 2011
 *
 * Copyright (c) 1998-2010 Glenn Randers-Pehrson
 *
 * This code is released under the libpng license.
 * For conditions of distribution and use, see the disclaimer
 * and license in png.h

 * You must edit this file to record the location of the zlib
 * source code.
 -->

<Project ToolsVersion="4.0"
   xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Label="Globals">
    <!-- Place the name of the directory containing the source of zlib used for
     debugging in this property.
         The directory need only contain the '.c' and '.h' files from the
     source.
     If you use a relative directory name (as below) then it must be
     relative to the project directories; these are one level deepers than
     the directories containing this file.
     -->
    <ZLibSrcDir>..\..\..\..\zlib</ZLibSrcDir>
  </PropertyGroup>
</Project>

..\..\..\..\zlib

评论很好:)

我想要的答案是编辑属性表。这是最新libpng源代码附带的属性表zlib.props。它与.sln文件位于同一文件夹中

<?xml version="1.0" encoding="utf-8"?>
<!--
 * zlib.props - location of zlib source
 *
 * libpng version 1.5.2 - March 31, 2011
 *
 * Copyright (c) 1998-2010 Glenn Randers-Pehrson
 *
 * This code is released under the libpng license.
 * For conditions of distribution and use, see the disclaimer
 * and license in png.h

 * You must edit this file to record the location of the zlib
 * source code.
 -->

<Project ToolsVersion="4.0"
   xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Label="Globals">
    <!-- Place the name of the directory containing the source of zlib used for
     debugging in this property.
         The directory need only contain the '.c' and '.h' files from the
     source.
     If you use a relative directory name (as below) then it must be
     relative to the project directories; these are one level deepers than
     the directories containing this file.
     -->
    <ZLibSrcDir>..\..\..\..\zlib</ZLibSrcDir>
  </PropertyGroup>
</Project>

..\..\..\..\zlib

注释非常好:)

well$(ZLibSrcDir)不是一个环境变量,它已经指向某个地方(我不希望它指向某个地方,但无论如何指向某个地方),并且该变量是随解决方案文件一起定义的。。。所有迹象都表明,每个解决方案都可以定义$(ZLibSrcDir),而定义环境变量是一种糟糕的做法,甚至可能行不通@阿夫拉姆:的确如此。在Windows中,环境变量的形式为
%var%
,而在VS变量中,包括从环境导入的变量-
$(var)
否,它不是环境变量$(ZLibSrcDir)指向C:\Users\AC\Documents\visualstudio 2010\Projects,在我的计算机下的环境变量中没有%ZLibSrcDir%的定义。很明显,$(ZLibSrcDir)是在其他地方定义的,所以在我的系统环境变量中没有。@Avram:您要编译的项目的作者希望您使用环境变量
%ZLibSrcDir%
将他的代码指向libzlib位置,这样他就可以通过
$(ZLibSrcDir)
在VS中使用此路径。不,它已经指向了某个地方。为什么你不明白这一点?好吧,$(ZLibSrcDir)不是一个环境变量,它已经指向某个地方(我不希望它指向某个地方,但无论如何它指向某个地方),并且该变量是随解决方案文件一起定义的。。。所有迹象都表明,每个解决方案都可以定义$(ZLibSrcDir),而定义环境变量是一种糟糕的做法,甚至可能行不通@阿夫拉姆:的确如此。在Windows中,环境变量的形式为
%var%
,而在VS变量中,包括从环境导入的变量-
$(var)
否,它不是环境变量$(ZLibSrcDir)指向C:\Users\AC\Documents\visualstudio 2010\Projects,在我的计算机下的环境变量中没有%ZLibSrcDir%的定义。很明显,$(ZLibSrcDir)是在其他地方定义的,所以在我的系统环境变量中没有。@Avram:您要编译的项目的作者希望您使用环境变量
%ZLibSrcDir%
将他的代码指向libzlib位置,这样他就可以通过
$(ZLibSrcDir)
在VS中使用此路径。不,它已经指向了某个地方。你为什么不明白?