3

I just installed Visual Studio 2015 RC Pro because I wanted to use c++11's std::to_string but it still doesn't seem to be 11...

std::cout << _cplusplus << std::endl;

Gives me 199711. Is VS 2015 RC not supposed to have 11? Or am I doing something wrong? Help appreciated.

Edit: it seems it isn't extremely clear what I want, so here's more info:

I want to use to_string, a member of std in c++11 which turns an int (in this case) into a string.

std::to_string(5);

gives me an error: "std has no member to_string"

cpplearner
  • 13,776
  • 2
  • 47
  • 72
  • possible duplicate of [Visual Studio 2012 \_\_cplusplus and C++ 11](http://stackoverflow.com/questions/14131454/visual-studio-2012-cplusplus-and-c-11) – Simon Jul 07 '15 at 10:40
  • VS2015 provides an nearly complete implementation of C++11, see e.g. http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx – Simon Jul 07 '15 at 10:43
  • Yeah but I don't seem to have 11 at all? Edit: http://blogs.msdn.com/b/vcblog/archive/2015/04/29/c-11-14-17-features-in-vs-2015-rc.aspx – Fred Pannekoek Jul 07 '15 at 10:46
  • Please check the SO question (and the answers) from my first comment. VS seems not to use the _cplusplus macro correctly, despite having implemented (most of) C++11. – Simon Jul 07 '15 at 10:51
  • 1
    But I don't care about the macro, I don't intend to use it. I only want std::to_string and it isn't there. I'm pretty sure C++11 is not implemented at all. And if it is, how can I get std::to_string to work? – Fred Pannekoek Jul 07 '15 at 10:54
  • Then please make your question more clear. std::to_string() is available: https://msdn.microsoft.com/de-de/library/ee404875.aspx – Simon Jul 07 '15 at 10:56
  • Maybe provide a short code sample which does not work. – Simon Jul 07 '15 at 10:58
  • You have included the header ? – Simon Jul 07 '15 at 11:05
  • 1
    Oh my God, i'm am retarded. I've been searching for this for hours and hours and I din't include the string header...Thanks dude – Fred Pannekoek Jul 07 '15 at 11:08

2 Answers2

8

Include the header <string>

Simon
  • 1,616
  • 2
  • 17
  • 39
2

VS2015 still doesn't fully support C++11, so the __cplusplus macro will remain as 97.

Cleroth
  • 144
  • 1
  • 11