Public bug reported:

Simple C++ code example to trigger this error:
#include <string>
#include <iostream>

int main()
{
  std::cout << std::to_string(4) << std::endl;
  return 0;
}

Building with:
g++-5 -std=c++11 main.cpp -o main

will yield this error:
main.cpp: In function 'int main()':
main.cpp:6:16: error: 'to_string' is not a member of 'std'
   std::cout << std::to_string(4) << std::endl;
                ^

however when building with "D_GLIBCXX_USE_C99" flag it works:
g++-5 -D_GLIBCXX_USE_C99 -std=c++11 main.cpp -o main

I do not think it should be necessary to provide this flag, especially
when G++ 5.4 does not need this flag on other distributions,
std::to_string was introduced in C++11, so -std=c++11 should be enough.

This was tested on Ubuntu 17.10

** Affects: gcc-5 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1739778

Title:
  G++ 5.4 does not compile some C++11 code without workaround flag

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1739778/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to