Visual Studio 2008 with c++11

前端 未结 5 968
小蘑菇
小蘑菇 2020-12-10 06:30

Can I somehow make Visual C++ 2008 to have C++11 library and use all the good things C++11 standard allows?

5条回答
  •  粉色の甜心
    2020-12-10 06:51

    Using Visual Studio 2008 may seem like a complete waste of time when you can use the latest Visual Studio Community free of charge coming with the latest C++ compilers. However, I very much prefer the Visual Studio 2008 IDE for C++. There's a lot of reasons but speed is perhaps the most obvious. The trick is to use the latest compilers and tools with the Visual Studio 2008 IDE. It actually works great without any issues what I've encountered doing this for years. Here's how I do it:

    1. delete %LOCALAPPDATA%/Microsoft/VisualStudio/9.0/VCComponents.dat
    2. edit /VC/vcpackages/VCProjectEngine.dll.config and /VC/vcpackages/AMD64.VCPlatform.config to reflect the paths of say Visual Studio 2019 Community, the Windows 10 SDK and any extra libraries you want.

    That's all you need! Tips: I use 2 environment variables to keep track of compiler version number and SDK version number CurrentUCRT=10.0.18362.0, CurrentVCTools=14.24.28314 which I change manually when needed. So a line in VCProjectEngine.dll.config looks for example like this: Include="$(CurrentVS)VC/Tools/MSVC/$(CurrentVCTools)/include;". I use symbolic links for the config files so I don't have to recreate them at new Visual Studio installs. You can also enable use of the clang compiler using this technique, like this:

    1. create an empty directory and place it first in the search order above.
    2. make a symbolic link to clang-cl.exe in the directory and name it cl.exe.
    3. Turn clang compiler off and on by renaming the symbolic link.

提交回复
热议问题