我正在尝试使用Visual Studio在命令行编译Qt库。 我正在遵循这些说明compiling Qt framework with Visual C++,但我无法启动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
我希望有人可以帮助我。
答案 0 :(得分:2)
我遇到了同样的问题。对我来说,这是系统变量路径中的错误条目。(一条路径被&#34包围;")
答案 1 :(得分:1)
现在有效。我手动设置系统变量,然后在vsinstalldir \ Common7 \ Tools中执行vsvars32.bat
最后我不知道为什么vcvars32.bat在我的电脑上不起作用。 ^^
答案 2 :(得分:0)
谢谢xMRI,我已经认识到问题似乎出现在vcvars32.bat文件中。 不幸的是,我无法找出问题所在。
命令promnpt输出:
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"
答案 3 :(得分:0)
我通过打开“VS2017的开发人员命令提示符(默认)”,在Windows Server 2012 R2上使用Visual Studio 2017编译了QT 5.10。根本不需要运行vcvarsall.bat或vsvar32.bat。在我的例子中,我使用了configure.bat的以下参数:
configure.bat -static -debug -platform win32-msvc
在此之前,我尝试编译它,就像在此处描述的那样:https://doc-snapshots.qt.io/qt5-dev/windows-building.html并遇到上述相同的问题。希望这有助于遇到同样问题的人。