Visual Studio 2008 with c++11

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-30 04:36:10

问题


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


回答1:


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++)



回答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.




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/20302891/visual-studio-2008-with-c11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!