10

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

Ivars
  • 2,375
  • 7
  • 22
  • 31
  • 1
    No, VS2008 has no C++11 support unless you hack in a different compiler. – chris Nov 30 '13 at 16:50
  • but maybe we could download additional c++11 library files? – Ivars Nov 30 '13 at 16:51
  • You'd have a hard time. Think of things like `std::tuple`, where every implementer is going to use variadic templates. – chris Nov 30 '13 at 16:53
  • 1
    There is a feature pack now which has many features from c++11. For example I found the c++11 header there. http://www.microsoft.com/en-us/download/confirmation.aspx?id=6922 – Catalyst Jun 16 '14 at 17:44

5 Answers5

7

In short words, it's impossible. VS2008 has no C++11 support and replacing the libraries would lead to chaos.

In long words, you maybe could do something:

  1. Use another compiler: C++ compiler support (Updated Link)
  2. You could upgrade your visual studio, but even MSVC12 (visual studio 2013) is not supporting all of C++11 standard.
  3. You could embed the Intel compiler into your visual studio. But also Intel is not fully supporting C++11, nevertheless more than MSVC. Here (Updated link now provides a general description) a small howto embed the Intel compiler.
  4. Update: clang is now also able to be used with visual studio, see here.
  5. Update: As Melebius stated in the comments, MSVC19 (VS2015) finally supports most of the C++11 standard... Support For C++11/14/17 Features (Modern C++)
user1810087
  • 5,146
  • 1
  • 41
  • 76
  • that's sad. i have an old machine and have to run winxp which is not supported since vs2010 (which has already a terrible performance on my pc). – Ivars Nov 30 '13 at 18:26
  • @user2543574 do you have to use visual studio? – user1810087 Nov 30 '13 at 19:12
  • no, but i'm not sure that other compilers would run faster than vc2008 – Ivars Dec 01 '13 at 07:21
  • 1
    by run faster: if you mean the ide give qt a try (maybe not the newest one)... also qt supports more compilers (i've tested with msvc, gcc and clang)... if you mean the compiler than you could try clang. – user1810087 Dec 01 '13 at 08:53
  • 1
    VS 2015 seems to finally support most of the C++11 standard. https://msdn.microsoft.com/en-us/library/hh567368.aspx – Melebius May 26 '17 at 09:11
2

If you're stuck using MSVC 2008 or 2010, I've managed to implement various C++11 (and some possibly-C++14) features for it as part of my cxxomfort backports library. Of course features that rely on lexer/parser support (such as variadic templates) can not be emulated, but for the most part it allows me to write forwards-compatible code in MSVC 2008 Express (my main Windows target).

However the idea would be that you use another compiler. There's GCC support for about as hight as 4.6 for Windows XP (via eg.: Mingw installer), and it brings about most of the important C++11 niceties such as variadic templates and constexpr, noexcept.

Luis Machuca
  • 1,047
  • 9
  • 16
2

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 <VS2008PATH>/VC/vcpackages/VCProjectEngine.dll.config and <VS2008PATH>/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.
BeErikk
  • 74
  • 1
  • 7
  • As I've been asked for details, an example of a modified config file can be viewed here: [My gist AMD64.VCPlatform.config](https://gist.github.com/BeErikk/41fe25afcc53a1917fee0e118376d926) – BeErikk Nov 25 '21 at 12:54
1

Some of the basics of the C++11 standard library are available in VS2008 by using Boost, which has plenty more useful tools too.

G Huxley
  • 1,130
  • 14
  • 19
0

If you can upgrade to MSVC++ 2010, it implements a limited subset of the standard. Back in 2011 Marc Gregoire built a nice PowerPoint slide set showing the C11 features supported in MS Visual C++ 2010.

(As someone who is limited to using XP as well at home, I can feel your pain.)

If you don't need to build MS-Windows, CLI or MFC apps, you might consider G++, which has a pretty broad subset of the C11 standard in the 32-bit version. If you don't have it, you can download the CYGWIN application/DLL at their website.

As someone mentioned upstream, you might try porting the more compliant compilers into MSVC. Alas, I haven't tried porting it yet, so I can't give you any tips or tricks to help in doing so.

Cr McDonough
  • 721
  • 6
  • 5