首先你需要下载的是
Microsoft Windows SDK for Windows 7 and .NET Framework 4. 下载以后你得到的是一个网络安装文件,确保网络的连接,安装Windows SDK 7.1 (注意得到的Windows SDK 版本是7.1,这和我们安装Vsiual Studio得到的SDK 版本v7.0A是不一样的);
安装界面如下:
安装结束以后你应该得到如下的
1. 在c:\Program Files\Microsoft Visual Studio 10.0,你会看到不完全的Visual Studio的安装(主要是VC的库和头文件)
2.在C:\Program Files\Microsoft SDKs\Windows\v7.1,你会看到Windows SDK的安装。
3. 在C:\Windows\Microsoft.NET,你会看到各个版本的Framework 的安装
4. 在HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7,你会看到如下的值
“10.0” “C:\Program Files\Microsoft Visual Studio 10.0\VC\”
“FrameworkDir32" “C:\Windows\Microsoft.NET\Framework\”
“FrameworkDir64" “C:\Windows\Microsoft.NET\Framework64”
"Framework32Ver” “v4.0.30319”
"Framework64Ver” “v4.0.30319”
但是这样你还是不能运行vc++环境。首先你不能再PATH路径找到nmake,cl,而且,即使把cl加到了PATH路径中, 你也不能正确的运行编译,你需要一个脚本来初始化设置;
在c:\Program Files\Microsoft Visual Studio 10.0中,有两个文件可以用来初始化环境,一个是Common7\Tools\vsvars32.bat,另一个是VC\vcvarsall.bat;
但是这两个文件需要更改,因为
1. 该文件查询注册HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7 表找寻VS的安装目录,但是HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7只有在完全安装Visual studio以后才存在。你需要的是通过HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7,通过去掉结尾的VC\来间接的找到VS的安装目录。
:GetVSCommonToolsDirHelper32 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "10.0"') DO ( @if "%%i"=="10.0" ( @SET "VS100COMNTOOLS=%%k" ) )
2.文件查询HKLM\SOFTWARE\Microsoft SDKs\Windows\v7.0A来确定Windows SDK的安装目录,但是 该目录是安装Visual Studio时候才会安装的较低版本,安装了Windows SDK和Framework以后的Windows SDK版本更高,是v7.1;
:GetWindowsSdkDirHelper @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" /v "InstallationFolder"') DO ( @if "%%i"=="InstallationFolder" ( @SET "WindowsSdkDir=%%k" ) )
为了设置vc环境变量,我创建了my_vcvarsall.bat,内容如下:
@echo off if "%1" == "" goto x86 if not "%2" == "" goto usage if /i %1 == x86 goto x86 if /i %1 == amd64 goto amd64 if /i %1 == x64 goto amd64 if /i %1 == ia64 goto ia64 if /i %1 == x86_amd64 goto x86_amd64 if /i %1 == x86_ia64 goto x86_ia64 goto usage :x86 if not exist "%~dp0bin\my_vcvars32.bat" goto missing call "%~dp0bin\my_vcvars32.bat" goto :eof :amd64 if not exist "%~dp0bin\amd64\vcvars64.bat" goto missing call "%~dp0bin\amd64\vcvars64.bat" goto :eof :ia64 if not exist "%~dp0bin\ia64\vcvars64.bat" goto missing call "%~dp0bin\ia64\vcvars64.bat" goto :eof :x86_amd64 if not exist "%~dp0bin\x86_amd64\vcvarsx86_amd64.bat" goto missing call "%~dp0bin\x86_amd64\vcvarsx86_amd64.bat" goto :eof :x86_ia64 if not exist "%~dp0bin\x86_ia64\vcvarsx86_ia64.bat" goto missing call "%~dp0bin\x86_ia64\vcvarsx86_ia64.bat" goto :eof :usage echo Error in script usage. The correct usage is: echo %0 [option] echo where [option] is: x86 ^| ia64 ^| amd64 ^| x86_amd64 ^| x86_ia64 echo: echo For example: echo %0 x86_ia64 goto :eof :missing echo The specified configuration type is missing. The tools for the echo configuration might not be installed. goto :eof
该文件会调用%~dp0bin\my_vcvars32.bat,,该文件的内容如下
@echo Setting environment for using Microsoft Visual Studio 2010 x86 tools. @call :GetVSCommonToolsDir @if "%VS100COMNTOOLS%"=="" goto error_no_VS100COMNTOOLSDIR @call "%VS100COMNTOOLS%my_VCVarsQueryRegistry.bat" 32bit No64bit @if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR @if "%FrameworkDir32%"=="" goto error_no_FrameworkDIR32 @if "%FrameworkVersion32%"=="" goto error_no_FrameworkVer32 @if "%Framework35Version%"=="" goto error_no_Framework35Version @set FrameworkDir=%FrameworkDir32% @set FrameworkVersion=%FrameworkVersion32% @if not "%WindowsSdkDir%" == "" ( @set "PATH=%WindowsSdkDir%bin\NETFX 4.0 Tools;%WindowsSdkDir%bin;%PATH%" @set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%" @set "LIB=%WindowsSdkDir%lib;%LIB%" ) @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% @set PATH=%FrameworkDir%%Framework35Version%;%PATH% @set PATH=%FrameworkDir%%FrameworkVersion%;%PATH% @set PATH=%VSINSTALLDIR%Common7\Tools;%PATH% @if exist "%VCINSTALLDIR%BIN" set PATH=%VCINSTALLDIR%BIN;%PATH% @set PATH=%DevEnvDir%;%PATH% @if exist "%VSINSTALLDIR%VSTSDB\Deploy" ( @set "PATH=%VSINSTALLDIR%VSTSDB\Deploy;%PATH%" ) @if not "%FSHARPINSTALLDIR%" == "" ( @set "PATH=%FSHARPINSTALLDIR%;%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% @set LIBPATH=%FrameworkDir%%Framework35Version%;%LIBPATH% @set LIBPATH=%FrameworkDir%%FrameworkVersion%;%LIBPATH% @goto end @REM ----------------------------------------------------------------------- :GetVSCommonToolsDir @set VS100COMNTOOLS= @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\VC7" /v "10.0"') DO ( @if "%%i"=="10.0" ( @SET "VS100COMNTOOLS=%%k" ) ) echo SET "VS100COMNTOOLS=%VS100COMNTOOLS:VC\=%" @SET "VS100COMNTOOLS=%VS100COMNTOOLS:VC\=%" @if "%VS100COMNTOOLS%"=="" exit /B 1 @SET "VS100COMNTOOLS=%VS100COMNTOOLS%Common7\Tools\" @exit /B 0 :GetVSCommonToolsDirHelper64 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" /v "10.0"') DO ( @if "%%i"=="10.0" ( @SET "VS100COMNTOOLS=%%k" ) ) @SET "VS100COMNTOOLS=%VS100COMNTOOLS:VC\=%" @if "%VS100COMNTOOLS%"=="" exit /B 1 @SET "VS100COMNTOOLS=%VS100COMNTOOLS%Common7\Tools\" @exit /B 0 @REM ----------------------------------------------------------------------- :error_no_VS100COMNTOOLSDIR @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_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_Framework35Version @echo ERROR: Cannot determine the .NET Framework 3.5 version. @goto end :end
该文件会调用Common7\Tools\my_VCVarsQueryRegistry.bat文件, 该文件内容是
@call :GetWindowsSdkDir @call :GetVSInstallDir @call :GetVCInstallDir @call :GetFSharpInstallDir @if "%1"=="32bit" ( @call :GetFrameworkDir32 @call :GetFrameworkVer32 ) @if "%2"=="64bit" ( @call :GetFrameworkDir64 @call :GetFrameworkVer64 ) @SET Framework35Version=v3.5 @goto end @REM ----------------------------------------------------------------------- :GetWindowsSdkDir @set WindowsSdkDir= @call :GetWindowsSdkDirHelper HKLM > nul 2>&1 @if errorlevel 1 call :GetWindowsSdkDirHelper HKCU > nul 2>&1 @if errorlevel 1 set WindowsSdkDir=%VCINSTALLDIR%\PlatformSDK\ @exit /B 0 :GetWindowsSdkDirHelper @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows \v7.1" /v "InstallationFolder"') DO ( @if "%%i"=="InstallationFolder" ( @SET "WindowsSdkDir=%%k" ) ) @if "%WindowsSdkDir%"=="" exit /B 1 @exit /B 0 @REM ----------------------------------------------------------------------- :GetVSInstallDir @set VSINSTALLDIR= @call :GetVSInstallDirHelper32 HKLM > nul 2>&1 @if errorlevel 1 call :GetVSInstallDirHelper32 HKCU > nul 2>&1 @if errorlevel 1 call :GetVSInstallDirHelper64 HKLM > nul 2>&1 @if errorlevel 1 call :GetVSInstallDirHelper64 HKCU > nul 2>&1 @exit /B 0 :GetVSInstallDirHelper32 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VC7" /v "10.0"') DO ( @if "%%i"=="10.0" ( @SET "L_VCINSTALLDIR=%%k" ) ) @SET "VSINSTALLDIR=%L_VCINSTALLDIR:VC\=%" @if "%VSINSTALLDIR%"=="" exit /B 1 @exit /B 0 :GetVSInstallDirHelper64 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Wow6432Node\Microsoft\VisualStudio \SxS\VC7" /v "10.0"') DO ( @if "%%i"=="10.0" ( SET "L_VS100VCInstallDirs=%%k" SET "VSINSTALLDIR=%L_VS100VCInstallDirs:VC\=%" ) ) @if "%VSINSTALLDIR%"=="" exit /B 1 @exit /B 0 @REM ----------------------------------------------------------------------- :GetVCInstallDir @set VCINSTALLDIR= @call :GetVCInstallDirHelper32 HKLM > nul 2>&1 @if errorlevel 1 call :GetVCInstallDirHelper32 HKCU > nul 2>&1 @if errorlevel 1 call :GetVCInstallDirHelper64 HKLM > nul 2>&1 @if errorlevel 1 call :GetVCInstallDirHelper64 HKCU > nul 2>&1 @exit /B 0 :GetVCInstallDirHelper32 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VC7" /v "10.0"') DO ( @if "%%i"=="10.0" ( @SET "VCINSTALLDIR=%%k" ) ) @if "%VCINSTALLDIR%"=="" exit /B 1 @exit /B 0 :GetVCInstallDirHelper64 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Wow6432Node\Microsoft\VisualStudio \SxS\VC7" /v "10.0"') DO ( @if "%%i"=="10.0" ( @SET "VCINSTALLDIR=%%k" ) ) @if "%VCINSTALLDIR%"=="" exit /B 1 @exit /B 0 @REM ----------------------------------------------------------------------- :GetFSharpInstallDir @set FSHARPINSTALLDIR= @call :GetFSharpInstallDirHelper32 HKLM > nul 2>&1 @if errorlevel 1 call :GetFSharpInstallDirHelper32 HKCU > nul 2>&1 @if errorlevel 1 call :GetFSharpInstallDirHelper64 HKLM > nul 2>&1 @if errorlevel 1 call :GetFSharpInstallDirHelper64 HKCU > nul 2>&1 @exit /B 0 :GetFSharpInstallDirHelper32 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\F#" /v "ProductDir"') DO ( @if "%%i"=="ProductDir" ( @SET "FSHARPINSTALLDIR=%%k" ) ) @if "%FSHARPINSTALLDIR%"=="" exit /B 1 @exit /B 0 :GetFSharpInstallDirHelper64 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Wow6432Node\Microsoft\VisualStudio \10.0\Setup\F#" /v "ProductDir"') DO ( @if "%%i"=="ProductDir" ( @SET "FSHARPINSTALLDIR=%%k" ) ) @if "%FSHARPINSTALLDIR%"=="" exit /B 1 @exit /B 0 @REM ----------------------------------------------------------------------- :GetFrameworkDir32 @set FrameworkDir32= @call :GetFrameworkDir32Helper32 HKLM > nul 2>&1 @if errorlevel 1 call :GetFrameworkDir32Helper32 HKCU > nul 2>&1 @if errorlevel 1 call :GetFrameworkDir32Helper64 HKLM > nul 2>&1 @if errorlevel 1 call :GetFrameworkDir32Helper64 HKCU > nul 2>&1 @exit /B 0 :GetFrameworkDir32Helper32 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VC7" /v "FrameworkDir32"') DO ( @if "%%i"=="FrameworkDir32" ( @SET "FrameworkDIR32=%%k" ) ) @if "%FrameworkDir32%"=="" exit /B 1 @exit /B 0 :GetFrameworkDir32Helper64 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Wow6432Node\Microsoft\VisualStudio \SxS\VC7" /v "FrameworkDir32"') DO ( @if "%%i"=="FrameworkDir32" ( @SET "FrameworkDIR32=%%k" ) ) @if "%FrameworkDIR32%"=="" exit /B 1 @exit /B 0 @REM ----------------------------------------------------------------------- :GetFrameworkb64 @set FrameworkDir64= @call :GetFrameworkDir64Helper32 HKLM > nul 2>&1 @if errorlevel 1 call :GetFrameworkDir64Helper32 HKCU > nul 2>&1 @if errorlevel 1 call :GetFrameworkDir64Helper64 HKLM > nul 2>&1 @if errorlevel 1 call :GetFrameworkDir64Helper64 HKCU > nul 2>&1 @exit /B 0 :GetFrameworkDir64Helper32 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VC7" /v "FrameworkDir64"') DO ( @if "%%i"=="FrameworkDir64" ( @SET "FrameworkDIR64=%%k" ) ) @if "%FrameworkDIR64%"=="" exit /B 1 @exit /B 0 :GetFrameworkDir64Helper64 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Wow6432Node\Microsoft\VisualStudio \SxS\VC7" /v "FrameworkDir64"') DO ( @if "%%i"=="FrameworkDir64" ( @SET "FrameworkDIR64=%%k" ) ) @if "%FrameworkDIR64%"=="" exit /B 1 @exit /B 0 @REM ----------------------------------------------------------------------- :GetFrameworkVer32 @set FrameworkVer32= @call :GetFrameworkVer32Helper32 HKLM > nul 2>&1 @if errorlevel 1 call :GetFrameworkVer32Helper32 HKCU > nul 2>&1 @if errorlevel 1 call :GetFrameworkVer32Helper64 HKLM > nul 2>&1 @if errorlevel 1 call :GetFrameworkVer32Helper64 HKCU > nul 2>&1 @exit /B 0 :GetFrameworkVer32Helper32 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VC7" /v "FrameworkVer32"') DO ( @if "%%i"=="FrameworkVer32" ( @SET "FrameworkVersion32=%%k" ) ) @if "%FrameworkVersion32%"=="" exit /B 1 @exit /B 0 :GetFrameworkVer32Helper64 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Wow6432Node\Microsoft\VisualStudio \SxS\VC7" /v "FrameworkVer32"') DO ( @if "%%i"=="FrameworkVer32" ( @SET "FrameworkVersion32=%%k" ) ) @if "%FrameworkVersion32%"=="" exit /B 1 @exit /B 0 @REM ----------------------------------------------------------------------- :GetFrameworkVer64 @set FrameworkVer64= @call :GetFrameworkVer64Helper32 HKLM > nul 2>&1 @if errorlevel 1 call :GetFrameworkVer64Helper32 HKCU > nul 2>&1 @if errorlevel 1 call :GetFrameworkVer64Helper64 HKLM > nul 2>&1 @if errorlevel 1 call :GetFrameworkVer64Helper64 HKCU > nul 2>&1 @exit /B 0 :GetFrameworkVer64Helper32 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VC7" /v "FrameworkVer64"') DO ( @if "%%i"=="FrameworkVer64" ( @SET "FrameworkVersion64=%%k" ) ) @if "%FrameworkVersion64%"=="" exit /B 1 @exit /B 0 :GetFrameworkVer64Helper64 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Wow6432Node\Microsoft\VisualStudio \SxS\VC7" /v "FrameworkVer64"') DO ( @if "%%i"=="FrameworkVer64" ( @SET "FrameworkVersion64=%%k" ) ) @if "%FrameworkVersion64%"=="" exit /B 1 @exit /B 0 @REM ----------------------------------------------------------------------- :end
至此,你可以起一个命令行,在代码里面敲入:
C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat
然后,就可以运行nmake,比如说来编译ruby的文件了。
如果你只是需要设置C#的环境,你需要修改\添加Common7\Tools\my_vsvars32.bat,该文件的内容如下
@echo Setting environment for using Microsoft Visual Studio 2010 x86 tools. @call :GetVSCommonToolsDir @if "%VS100COMNTOOLS%"=="" goto error_no_VS100COMNTOOLSDIR @call "%VS100COMNTOOLS%my_VCVarsQueryRegistry.bat" 32bit No64bit @if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR @if "%FrameworkDir32%"=="" goto error_no_FrameworkDIR32 @if "%FrameworkVersion32%"=="" goto error_no_FrameworkVer32 @if "%Framework35Version%"=="" goto error_no_Framework35Version @set FrameworkDir=%FrameworkDir32% @set FrameworkVersion=%FrameworkVersion32% @if not "%WindowsSdkDir%" == "" ( @set "PATH=%WindowsSdkDir%bin\NETFX 4.0 Tools;%WindowsSdkDir%bin;%PATH%" @set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%" @set "LIB=%WindowsSdkDir%lib;%LIB%" ) @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% @set PATH=%FrameworkDir%%Framework35Version%;%PATH% @set PATH=%FrameworkDir%%FrameworkVersion%;%PATH% @set PATH=%VSINSTALLDIR%Common7\Tools;%PATH% @if exist "%VCINSTALLDIR%BIN" set PATH=%VCINSTALLDIR%BIN;%PATH% @set PATH=%DevEnvDir%;%PATH% @if exist "%VSINSTALLDIR%VSTSDB\Deploy" ( @set "PATH=%VSINSTALLDIR%VSTSDB\Deploy;%PATH%" ) @if not "%FSHARPINSTALLDIR%" == "" ( @set "PATH=%FSHARPINSTALLDIR%;%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% @set LIBPATH=%FrameworkDir%%Framework35Version%;%LIBPATH% @set LIBPATH=%FrameworkDir%%FrameworkVersion%;%LIBPATH% @goto end @REM ----------------------------------------------------------------------- :GetVSCommonToolsDir @set VS100COMNTOOLS= @call :GetVSCommonToolsDirHelper32 HKLM > nul 2>&1 @rem call :GetVSCommonToolsDirHelper32 HKLM @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\VC7" /v "10.0"') DO ( @if "%%i"=="10.0" ( @SET "L_VS100VCInstallDirs=%%k" ) ) @echo SET "VS100COMNTOOLS=%L_VS100VCInstallDirs:VC\=%" @SET "VS100COMNTOOLS=%L_VS100VCInstallDirs:VC\=%" @if "%VS100COMNTOOLS%"=="" exit /B 1 @SET "VS100COMNTOOLS=%VS100COMNTOOLS%Common7\Tools\" @exit /B 0 :GetVSCommonToolsDirHelper64 @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Wow6432Node\Microsoft\VisualStudio \SxS\VC7" /v "10.0"') DO ( @if "%%i"=="10.0" ( SET "L_VS100VCInstallDirs=%%k" SET "VS100COMNTOOLS=%L_VS100VCInstalldirs:VC\=%" ) ) @if "%VS100COMNTOOLS%"=="" exit /B 1 @SET "VS100COMNTOOLS=%VS100COMNTOOLS%Common7\Tools\" @exit /B 0 @REM ----------------------------------------------------------------------- :error_no_VS100COMNTOOLSDIR @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_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_Framework35Version @echo ERROR: Cannot determine the .NET Framework 3.5 version. @goto end :end
如代码所示,你Common7\Tools\my_vsvars32.bat 会调用Common7\Tools\my_VCVarsQueryRegistry.bat 的文件;my_VCVarsQueryRegistry.bat的文件内容在上面已经已经介绍了。
至此,所有的配置都已经结束,本文中的配置只是在win32 x85环境下测试过了,没有测试过amd64,但是思路是一样的,你可以按照类似的方法调试通过64的配置;
References:
相关推荐
2. **复制glut.h**:将解压后的`glut.h`文件复制到Visual Studio 2005的安装目录下的`VC\PlatformSDK\include\gl`文件夹中。 3. **复制glut.lib和glut32.lib**:将解压后的`glut.lib`和`glut32.lib`文件复制到`VC\...
Windows SDK(Software Development Kit)与Visual Studio(VS)2017是解决此类问题的重要工具。本文将详细探讨这两个组件以及它们自带的库,特别是针对"um", "ucrt", "vcrt"这三个子库。 **Windows SDK** Windows...
在本例中,"SDK(vc6.0用)"特指适用于Visual C++ 6.0版本的SDK,这是一款经典且广泛使用的C++集成开发环境。 Visual C++ 6.0是由Microsoft公司推出的,用于开发Windows应用程序的IDE。它包括了编译器、调试器以及...
Visual Studio 6.0的补丁,以及它支持的是后一版SDK,下载自微软官方网站,自封为iso格式。 7.en_visual_studio_6.0_enterprise_cd7(sp5).iso 8.en_visual_studio_6.0_enterprise_cd8(sp6).iso 9.en_visual_...
在本文中,我们将深入探讨如何使用VC++(Visual C++)来创建具有Visual Studio风格的用户界面,并且基于提供的资源,即"VC VisualStudio风格的界面源代码",我们可以学习和理解实现这一目标的关键技术与步骤。...
Platform SDK是Visual C++和整个Visual Studio的基石,它提供了编译、链接和调试程序的功能,是整个Visual Studio的核心组件。 在实际开发中,我们经常会使用Visual C++6.0,它是一个基于Windows操作系统的可视化...
我只想用最基本的C++开发,不需要MFC,也不需要用连网安装。 所以下载了一个离线安装版本放在这里,我自己用的现成的文件。 使用以下命令行创建: vs2019.exe --layout d:\vs2019 --lang zh-...
尽管后来有更新版本的Visual Studio发布,但VC6.0以其轻巧、稳定、高效的特点,在某些领域仍然保持着不可替代的地位。绿色精简版的VC6.0,意味着它去除了不必要的组件,只保留了最核心的开发工具,便于快速部署和...
这个问题表明Visual Studio无法识别项目的Qt版本或者没有正确配置与Windows(win32平台)兼容的Qt环境。为了解决这个问题,我们可以按照以下步骤进行操作: 首先,当出现这个错误时,不要惊慌。这通常是因为在...
源码和Visual Studio工程的提供意味着用户可以在Windows 7环境下使用Microsoft Visual C++(VC)编译器来构建iperf程序,这对于开发者或者网络管理员来说是极其有用的资源。 iperf 的主要功能包括: 1. **TCP和UDP...
OgreSDK_vc9_v1-7-1p1.zip是一款专为Visual Studio 2008设计的Ogre游戏开发框架的SDK(Software Development Kit)压缩包。Ogre是一个开源的3D渲染引擎,广泛应用于游戏开发、模拟软件以及可视化应用等领域。它的...
根据微软的说法,VC6支持的最后一个SDK是windows2003 february版本。 幸运的是在网上找到了windowsxp sp2版本。与大家分享并上传作为收藏,如有需要,可继续上传windows2003 february版本。 30M限制,本SDK平台分成...
为了能够在 Visual Studio 2005 这样的集成开发环境中顺利使用 OpenGL 进行开发,我们需要对开发环境进行相应的配置。本文将详细介绍如何在 Visual Studio 2005 下配置 OpenGL 开发环境,并提供一个简单的 OpenGL ...
在Windows上,通常使用Visual Studio作为开发环境。本文将详细介绍如何配置OpenCV以在Visual Studio中进行开发。 1. **下载和安装OpenCV SDK** 首先,你需要从官方网站[opencv.org](http://opencv.org/)下载...
可能包括如何设置开发环境,如使用Visual Studio(VC)集成开发环境,创建Win32 Console或Windows应用程序项目,以及如何使用API函数实现基本功能。 "MyApp"这个文件是实际的源代码示例。在VC环境下,它可能是一个...
在Windows上,我们可以选择使用Microsoft Visual Studio,它不仅包含了一个功能强大的IDE(集成开发环境),还提供了Visual C++编译器。安装时,确保选中“C++工具”和“C++桌面开发”工作负载。 至于VC,它是...
在Windows 7 Professional 64位系统上安装Visual Studio 6是一个相对复杂的过程,因为这个IDE(集成开发环境)最初是为32位操作系统设计的。以下是一份详细步骤,帮助您成功安装Visual Studio 6: 1. **系统兼容性*...
标题和描述均指向了一个关于如何安装和配置DDK(Windows Driver Kit)+Visual C++(VC)+DriverStudio3.2环境的文档,旨在帮助初学者搭建一个完整的Windows驱动开发环境。以下是对这一知识点的深入解析: ### 知识点1:...
放置位置:根据描述,"放到这个目录就可以啦 C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A",这表明SDK的安装路径应当遵循微软的推荐,确保系统能够正确识别和调用相关资源。这个目录结构使得系统能够方便...
本文档主要探讨了在Windows 7操作系统环境下使用Visual Studio 2005或2008开发WinCE智能设备应用程序时遇到的一个常见问题——即系统无法识别已安装的WinCE 5 SDK(Software Development Kit)。该问题对于开发者来...