When trying to compile the following C++ snippet with gcc 5.4 without any flags I get an error (as expected).
error:
When I use the `-std=c++14` flag on Ubuntu 16.04.2 LTS it compiles and runs fine. Even with the flag I get the same error as before on FreeBSD, even with what is supposed to be the same version of gcc:
On Ubuntu:
Does anyone have an explanation for this different behavour and a suggestion on how I can get this to run? (This is just a minimal example of trying to get https://github.com/clangen/musikcube to compile on FreeBSD.)
Code:
#include <string>
#include <iostream>
int main(){
std::cout << std::to_string(0) << "\n";
return 0;
}
error:
Code:
$ g++-5 test.cpp
test.cpp: In function ‘int main()’:
test.cpp:6:18: error: ‘to_string’ is not a member of ‘std’
When I use the `-std=c++14` flag on Ubuntu 16.04.2 LTS it compiles and runs fine. Even with the flag I get the same error as before on FreeBSD, even with what is supposed to be the same version of gcc:
Code:
$ g++5 --version
g++5 (FreeBSD Ports Collection) 5.4.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.
$ g++5 -std=c++14 test.cpp test.cpp: In function 'int main()':
test.cpp:6:18: error: 'to_string' is not a member of 'std'
std::cout << std::to_string(0) << "\n";
On Ubuntu:
Code:
% g++-5 --version
g++-5 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
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.
Does anyone have an explanation for this different behavour and a suggestion on how I can get this to run? (This is just a minimal example of trying to get https://github.com/clangen/musikcube to compile on FreeBSD.)