2014-06-16 218 views
1

我想在命令行中用Visual Studio編譯Qt庫。 我按照這些說明compiling Qt framework with Visual C++,但我無法啓動Visual Studio的vcvarsall.bat。無法執行vcvarsall.bat

以下錯誤顯示在命令提示符:「\微軟不能在這一點上

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旗艦版64位;

安裝VS:視覺Studio 2013 Express和Visual Studio 2013 Ultimate

我已經搜索了有關這個問題的網絡洞,但似乎我是vcvarsall.bat中唯一發生這種錯誤的人。 :D

我希望有人能幫助我。

+0

只需在@echo off的第一行添加註釋即可。它認爲存在語法問題。而命令處理器無法確定正確的參數。您可能不得不在下一批次中重複此操作。你應該找到導致問題的位置。 – xMRi

+0

@xMRi謝謝你的回答。看來問題出在vcvars32.bat中,但我看不到錯誤發生在哪裏。 – Elyptos

回答

0

現在有效。我手動設置了系統變量,然後我在vsinstalldir \ Common7 \ Tools中執行了vsvars32.bat

最後我不知道爲什麼vcvars32.bat不能在我的電腦上工作。 ^^

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" 
+0

只是爲了確定。您是否將COMSPEC設置爲CMD.EXE以外的其他設置?更改vcvars32.bat文件並刪除行首的所有@。否則,您需要再次輸入錯誤行。 – xMRi

+0

@xMRi錯誤發生在「set FrameworkVersion」命令和帶有系統變量的部分之間。系統變量COMSPEC指向cmd.exe – Elyptos

2

我剛剛有同樣的問題。對我來說,這是一個不正確的條目在系統變量路徑(一條路徑被「」包圍)

0

我編譯QT 5.10在Windows Server 2012 R2與Visual Studio 2017打開「開發人員命令提示符VS2017(默認)」 。根本不需要運行vcvarsall.bat或vsvar32.bat。在我來說,我用下面的參數configure.bat:

,我試圖編譯它喜歡它在這裏描述之前:https://doc-snapshots.qt.io/qt5-dev/windows-building.html跑進上述同樣的問題。希望這可以幫助遇到同樣問題的人。