5

The following simple program can't be compiled in cygwin with gcc

#include <string>
#include <iostream>

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

Command line:

$ g++ -std=c++0x to_string.cc

Error:

to_string.cc: In function ‘int main()’:
to_string.cc:6:16: error: ‘to_string’ is not a member of ‘std’
   std::cout << std::to_string(4) << std::endl;

G++ version:

$ g++ --version
g++ (GCC) 5.2.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The same code can be compiled in Ubuntu.

Is it possible at all compile this code with cygwin or I need to write a workaround?

Alex
  • 9,891
  • 11
  • 53
  • 87

1 Answers1

-2

You are mixing gcc and g++ here

To quote Mike F: "The probably most important difference in their defaults is which libraries they link against automatically."

What is the difference between g++ and gcc?

Community
  • 1
  • 1
Simon Kraemer
  • 5,700
  • 1
  • 19
  • 49