How to use Visual Studio 2010 C++ tools in Visual

2019-07-18 18:04发布

If possible at all, does anyone know how to use the full c++ toolset shipped with Visual Studio 2010 (compiler/linker/sdk) in Visual Studio 2008?
Would changing all directories listen under Options->Projects and Solutions->VC++ Directories be sufficient, or is there more to it? And suppose I try it this way, are there any caveats to it?

1条回答
不美不萌又怎样
2楼-- · 2019-07-18 18:39

I kinda forgot about this question until today a friend was saying how great C++0x was. I'm still in love with VS2008, much more than with 2010 which is above all things slow, so decided to give it a go. And, I still can't believe it, but with a minimum of hacks it actually works.

And it works great: sitting before VS2008 you don't even notice it's actually using the 2010 toolset. Unless you look at cl/link's logo. Or off course, unless you are suddenly able to use lambdas. I could not find any problems so far whatsoever. Editing etc works like it alwasy did, building works, debugging works, that's all I need.

Here's what I did:

  • make a batch file setting up the envorinment for use with Windows SDK 7.1 / VS2010 toolset, but leaving devenv from the VS2008 installation. Mostly copied this from 2010's setenv.cmd.
  • now the dirty bit: copy msobj100.dll, mspdb100.dll , mspdbcore.dll and mspdbsrv.exe into the 2010's VSINSTALLDIR/bin directory (or put them in your PATH somweher). This is required else cl.exe doesn't work, nor would debugging.
  • launch from same command line where batch file was run using devenv /useenv
  • smile

This is the used batchfile for an x64 machine:

SET PlatformToolset=Windows7.1SDK
SET ToolsVersion=4.0
SET WindowsSDKVersionOverride=v7.1
SET Path32=%ProgramFiles(x86)%
SET "VCINSTALLDIR=%Path32%\Microsoft Visual Studio 10.0\VC\"
SET "VSINSTALLDIR=%Path32%\Microsoft Visual Studio 10.0\"
SET "VCTools=%VCINSTALLDIR%Bin"
SET "VCTools=%VCTools%;%VCTools%\VCPackages;"
SET "VCLibraries=%VCINSTALLDIR%Lib"
SET "VCIncludes=%VCINSTALLDIR%INCLUDE"
SET Path=%FxTools%;%VSTools%;%VCTools%;%SdkTools%;%Path%
SET OSLibraries=%WindowsSdkDir%Lib
SET OSIncludes=%WindowsSdkDir%INCLUDE;%WindowsSdkDir%INCLUDE\gl
SET "LIB=%VCLibraries%;%OSLibraries%;%FxTools%"
SET "LIBPATH=%FxTools%;%VCLibraries%"
SET "INCLUDE=%VCIncludes%;%OSIncludes%"

EDIT instead of batchfile combined with /useenv, there's another way that does the same but more direct: the settings for VC++ Directories are all saved in the file %APPDATA%/VisualStudio/9.0/VCComponents.dat. So if you take the original one and replace all occurrences of $(VCINSTALLDIR) with $(ProgramFiles)\Microsoft Visual Studio 10.0\VC\ it works as well.

查看更多
登录 后发表回答