Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt 无法执行vcvarsall.bat_Qt_Batch File_Visual Studio 2013 - Fatal编程技术网

Qt 无法执行vcvarsall.bat

Qt 无法执行vcvarsall.bat,qt,batch-file,visual-studio-2013,Qt,Batch File,Visual Studio 2013,我正试图在命令行上用visualstudio编译Qt库。 我正在按照这些说明进行操作,但启动Visual Studio的vcvarsall.bat时遇到问题 命令提示符上显示以下错误:“\Microsoft此时无法按语法处理 Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten. C:\windows\system32>cd .. C:

我正试图在命令行上用visualstudio编译Qt库。 我正在按照这些说明进行操作,但启动Visual Studio的vcvarsall.bat时遇到问题

命令提示符上显示以下错误:“\Microsoft此时无法按语法处理

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.

C:\windows\system32>cd ..

C:\Windows>cd..

C:\>cd \Program Files (x86)\Microsoft Visual Studio 12.0\VC\

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC>vcvarsall.bat amd64
"\Microsoft" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC>
操作系统:Windows 7 Ultimate x64;

已安装VS:Visual Studio 2013 Express和Visual Studio 2013 Ultimate

我已经在网上搜索过这个问题,但似乎只有我在vcvarsall.bat中犯了这样的错误。:D


我希望有人能帮助我。

谢谢xMRI,我已经意识到问题似乎在vcvars32.bat文件中。 不幸的是,我很难找出问题所在

此处命令输出:

C:\windows\system32>if "x86" == "" goto x86

C:\windows\system32>if not "" == "" goto usage

C:\windows\system32>if /I x86 == x86 goto x86

C:\windows\system32>if not exist "C:\Program Files (x86)\Microsoft Visual Studio
  12.0\VC\bin\vcvars32.bat" goto missing

C:\windows\system32>call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC
  \bin\vcvars32.bat"
**"\Microsoft" kann syntaktisch an dieser Stelle nicht verarbeitet werden.**
C:\windows\system32>    @set "PATH=C:\Program Files (x86)\Microsoft SDKs\Windows
  \v8.1A\bin\NETFX 4.5.1 Tools\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Python34\;C:\P
  ython34\Scripts;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;"C:\Progr
  am Files (x86)\Microsoft DirectX SDK (December 2005)\Utilities\Bin\x86";C:\Progr
  am Files\AuthenTec TrueSuite\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Progr
  am Files\Intel\iCLS Client\;C:\Program Files\Common Files\Microsoft Shared\Windo
  ws Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\win
  dows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPow
  erShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\
  Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64
  ;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Fil
  es\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\
  Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R)
  Management Engine Components\IPT;C:\Program Files\Java\jre7\bin;C:\Program Files
  \Java\jdk1.7.0_45\bin;C:\Program Files\Common Files\Autodesk Shared\;C:\Program
  Files (x86)\Autodesk\Backburner\;C:\Program Files\Microsoft SQL Server\110\Tools
  \Binn\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;C:\Program Files\Jav
  a\Java3D\1.5.1\bin;C:\Program Files (x86)\QuickTime\QTSystem\;c:\Program Files (
  x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\
  110\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolki
  t\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files (x86)\
  Git\cmd; C:\Windows\System32; C:\Program Files (x86)\Microsoft Visual Studio 12.
  0\VC\qt5;C:\Ruby200\bin"
C:\windows\system32>
这里是vcvars32.bat文件:

::@echo off

@SET VSINSTALLDIR=c:\Program Files\Microsoft Visual Studio 12.0\
@SET VCINSTALLDIR=c:\Program Files\Microsoft Visual Studio 12.0\VC\
@SET FrameworkDir32=c:\Windows\Microsoft.NET\Framework\
@SET FrameworkVersion32=v4.0.30319
@SET Framework40Version=v3.5

@call :GetVSCommonToolsDir

@if "%VS120COMNTOOLS%"=="" goto error_no_VS120COMNTOOLSDIR

@call "%VS120COMNTOOLS%VCVarsQueryRegistry.bat" 32bit No64bit

@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR
@if "%FrameworkDir32%"=="" goto error_no_FrameworkDIR32
@if "%FrameworkVersion32%"=="" goto error_no_FrameworkVer32
@if "%Framework40Version%"=="" goto error_no_Framework40Version

@set FrameworkDir=%FrameworkDir32%
@set FrameworkVersion=%FrameworkVersion32%

@if not "%WindowsSDK_ExecutablePath_x86%" == "" (
    @set "PATH=%WindowsSDK_ExecutablePath_x86%;%PATH%"
)

@if not "%WindowsSdkDir%" == "" (
    @set "PATH=%WindowsSdkDir%bin\x86;%PATH%"
    @set "INCLUDE=%WindowsSdkDir%include\shared;%WindowsSdkDir%include\um;%WindowsSdkDir%include\winrt;%INCLUDE%"
    @set "LIB=%WindowsSdkDir%lib\winv6.3\um\x86;%LIB%"
    @set "LIBPATH=%WindowsSdkDir%References\CommonConfiguration\Neutral;%ExtensionSDKDir%\Microsoft.VCLibs\12.0\References\CommonConfiguration\neutral;%LIBPATH%"
)

@rem
@rem Root of Visual Studio IDE installed files.
@rem
@set DevEnvDir=%VSINSTALLDIR%Common7\IDE\

@rem PATH
@rem ----
@if exist "%VSINSTALLDIR%Team Tools\Performance Tools" (
    @set "PATH=%VSINSTALLDIR%Team Tools\Performance Tools;%PATH%"
)
@if exist "%ProgramFiles%\HTML Help Workshop" set PATH=%ProgramFiles%\HTML Help Workshop;%PATH%
@if exist "%ProgramFiles(x86)%\HTML Help Workshop" set PATH=%ProgramFiles(x86)%\HTML Help Workshop;%PATH%
@if exist "%VCINSTALLDIR%VCPackages" set PATH=%VCINSTALLDIR%VCPackages;%PATH%
@if exist "%FrameworkDir%%Framework40Version%" set PATH=%FrameworkDir%%Framework40Version%;%PATH%
@if exist "%FrameworkDir%%FrameworkVersion%" set PATH=%FrameworkDir%%FrameworkVersion%;%PATH%
@if exist "%VSINSTALLDIR%Common7\Tools" set PATH=%VSINSTALLDIR%Common7\Tools;%PATH%
@if exist "%VCINSTALLDIR%BIN" set PATH=%VCINSTALLDIR%BIN;%PATH%
@set PATH=%DevEnvDir%;%PATH%

@rem Add path to MSBuild Binaries
@if exist "%ProgramFiles%\MSBuild\12.0\bin" set PATH=%ProgramFiles%\MSBuild\12.0\bin;%PATH%
@if exist "%ProgramFiles(x86)%\MSBuild\12.0\bin" set PATH=%ProgramFiles(x86)%\MSBuild\12.0\bin;%PATH%


@if exist "%VSINSTALLDIR%VSTSDB\Deploy" (
    @set "PATH=%VSINSTALLDIR%VSTSDB\Deploy;%PATH%"
)

@if not "%FSHARPINSTALLDIR%" == "" (
    @set "PATH=%FSHARPINSTALLDIR%;%PATH%"
)

@if exist "%DevEnvDir%CommonExtensions\Microsoft\TestWindow" (
    @set "PATH=%DevEnvDir%CommonExtensions\Microsoft\TestWindow;%PATH%"
)

@rem INCLUDE
@rem -------
@if exist "%VCINSTALLDIR%ATLMFC\INCLUDE" set INCLUDE=%VCINSTALLDIR%ATLMFC\INCLUDE;%INCLUDE%
@if exist "%VCINSTALLDIR%INCLUDE" set INCLUDE=%VCINSTALLDIR%INCLUDE;%INCLUDE%

@rem LIB
@rem ---
@if exist "%VCINSTALLDIR%ATLMFC\LIB" set LIB=%VCINSTALLDIR%ATLMFC\LIB;%LIB%
@if exist "%VCINSTALLDIR%LIB" set LIB=%VCINSTALLDIR%LIB;%LIB%

@rem LIBPATH
@rem -------
@if exist "%VCINSTALLDIR%ATLMFC\LIB" set LIBPATH=%VCINSTALLDIR%ATLMFC\LIB;%LIBPATH%
@if exist "%VCINSTALLDIR%LIB" set LIBPATH=%VCINSTALLDIR%LIB;%LIBPATH%
@if exist "%FrameworkDir%%Framework40Version%" set LIBPATH=%FrameworkDir%%Framework40Version%;%LIBPATH%
@set LIBPATH=%FrameworkDir%%FrameworkVersion%;%LIBPATH%

@goto end

@REM -----------------------------------------------------------------------
:GetVSCommonToolsDir
@set VS120COMNTOOLS=
@call :GetVSCommonToolsDirHelper32 HKLM > nul 2>&1
@if errorlevel 1 call :GetVSCommonToolsDirHelper32 HKCU > nul 2>&1
@if errorlevel 1 call :GetVSCommonToolsDirHelper64  HKLM > nul 2>&1
@if errorlevel 1 call :GetVSCommonToolsDirHelper64  HKCU > nul 2>&1
@exit /B 0

:GetVSCommonToolsDirHelper32
@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "12.0"') DO (
    @if "%%i"=="12.0" (
        @SET "VS120COMNTOOLS=%%k"
    )
)
@if "%VS120COMNTOOLS%"=="" exit /B 1
@SET "VS120COMNTOOLS=%VS120COMNTOOLS%Common7\Tools\"
@exit /B 0

:GetVSCommonToolsDirHelper64
@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" /v "12.0"') DO (
    @if "%%i"=="12.0" (
        @SET "VS120COMNTOOLS=%%k"
    )
)
@if "%VS120COMNTOOLS%"=="" exit /B 1
@SET "VS120COMNTOOLS=%VS120COMNTOOLS%Common7\Tools\"
@exit /B 0

@REM -----------------------------------------------------------------------
:error_no_VS120COMNTOOLSDIR
@echo ERROR: Cannot determine the location of the VS Common Tools folder.
@goto end

:error_no_VSINSTALLDIR
@echo ERROR: Cannot determine the location of the VS installation.
@goto end

:error_no_VCINSTALLDIR
@echo ERROR: Cannot determine the location of the VC installation.
@goto end

:error_no_FrameworkDIR32
@echo ERROR: Cannot determine the location of the .NET Framework 32bit installation.
@goto end

:error_no_FrameworkVer32
@echo ERROR: Cannot determine the version of the .NET Framework 32bit installation.
@goto end

:error_no_Framework40Version
@echo ERROR: Cannot determine the .NET Framework 4.0 version.
@goto end

:end
编辑:

出现错误的部件:

C:\windows\system32>set FrameworkVersion=v5.1.20409.0
"\Microsoft" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
C:\windows\system32>    set "PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\
v8.1A\bin\NETFX 4.5.1 Tools\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Python34\;C:\Py
thon34\Scripts;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;"C:\Progra
m Files (x86)\Microsoft DirectX SDK (December 2005)\Utilities\Bin\x86";C:\Progra
m Files\AuthenTec TrueSuite\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Progra
m Files\Intel\iCLS Client\;C:\Program Files\Common Files\Microsoft Shared\Window
s Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\wind
ows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowe
rShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\I
ntel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program File
s\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\I
ntel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) M
anagement Engine Components\IPT;C:\Program Files\Java\jre7\bin;C:\Program Files\
Java\jdk1.7.0_45\bin;C:\Program Files\Common Files\Autodesk Shared\;C:\Program F
iles (x86)\Autodesk\Backburner\;C:\Program Files\Microsoft SQL Server\110\Tools\
Binn\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;C:\Program Files\Java
\Java3D\1.5.1\bin;C:\Program Files (x86)\QuickTime\QTSystem\;c:\Program Files (x
86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\1
10\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit
\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files (x86)\G
it\cmd; C:\Windows\System32; C:\Program Files (x86)\Microsoft Visual Studio 12.0
\VC\qt5;C:\Ruby200\bin"

现在可以了。我手动设置了系统变量,然后在vsinstalldir\Common7\Tools中执行了vsvars32.bat


最后,我不知道为什么vcvars32.bat不能在我的计算机上工作。^^ ^

我也遇到了同样的问题。对我来说,这是系统变量路径中的一个不正确条目。(一个路径被“”包围)

我在Windows Server 2012 R2上用Visual Studio 2017编译了QT 5.10,方法是打开VS2017的“开发者命令提示符”(默认值)“。根本不需要运行vcvarsall.bat或vsvar32.bat。在我的例子中,我对configure.bat使用了以下参数:

        configure.bat -static -debug -platform win32-msvc

在此之前,我试图像这里描述的那样编译它:并且遇到了上面描述的相同问题。希望这对遇到同样问题的人有所帮助。

只需在第一行添加一条注释,并使用@echo off。这可能是语法问题。命令处理器无法确定正确的参数。您可能需要在下一个调用的批处理中重复此操作。您应该找到导致问题的位置。@xMRi谢谢您的回答。似乎问题出在vcvars32.bat中,但我看不出错误发生在哪里。只是为了确定一下。您是否将COMSPEC设置为CMD.EXE以外的其他内容?更改vcvars32.bat文件并删除行首的所有@。否则,您需要再次显示错误行。@xMRi错误在“set FrameworkVersion”命令和带有系统变量的零件之间。系统变量COMSPEC指向cmd.exe