Solved Is it possible to to have g++5 use ISO C++ 2011

I am trying to build a program that requires, compiler and library support for the ISO C++ 2-11 standard for g++ 5. I installed g++5 from ports, wondering if it is possible to enable this on free bsd FreeBSD 10.2?

Here is my error code when I try to build it.

Code:
make CC=gcc5 CXX=g++5 CPP="gcc5 -E"
g++5 -DHAVE_CONFIG_H -I. -I./src/common   -D__FREEBSD__    -DdsUDPSERV   -I/usr/local/include/luajit-2.0 -I/usr/local/include/mysql -isystem /usr/local/include -fstack-protector -fno-strict-aliasing  -g -fno-omit-frame-pointer -fno-strict-aliasing  -g -O2 -MT dsgame-blowfish.o -MD -MP -MF .deps/dsgame-blowfish.Tpo -c -o dsgame-blowfish.o `test -f 'src/common/blowfish.cpp' || echo './'`src/common/blowfish.cpp
In file included from /usr/local/lib/gcc5/include/c++/chrono:35:0,
                 from src/common/../common/../common/cbasetypes.h:333,
                 from src/common/../common/blowfish.h:27,
                 from src/common/blowfish.cpp:24:
/usr/local/lib/gcc5/include/c++/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
  ^
In file included from src/common/../common/blowfish.h:27:0,
                 from src/common/blowfish.cpp:24:
src/common/../common/../common/cbasetypes.h:335:22: error: 'chrono_literals' is not a namespace-name
using namespace std::chrono_literals;
                      ^
src/common/../common/../common/cbasetypes.h:335:37: error: expected namespace-name before ';' token
using namespace std::chrono_literals;
                                     ^
src/common/../common/../common/cbasetypes.h:336:7: error: expected nested-name-specifier before 'server_clock'
using server_clock = std::chrono::steady_clock;
       ^
src/common/../common/../common/cbasetypes.h:337:7: error: expected nested-name-specifier before 'time_point'
using time_point = server_clock::time_point;
       ^
src/common/../common/../common/cbasetypes.h:338:7: error: expected nested-name-specifier before 'duration'
using duration = server_clock::duration;
       ^
*** Error code 1

Stop.

Thanks in advance
 
You must pass `-std=c++11' flag to compiler:

Code:
[david@ ~]$ g++5 test.cpp -o test
test.cpp: In function 'int main(int, char**)':
test.cpp:4:10: error: 'bar' does not name a type
  auto bar = &foo;
  ^
test.cpp:5:5: error: 'bar' was not declared in this scope
  bar = nullptr;
  ^
test.cpp:5:11: error: 'nullptr' was not declared in this scope
  bar = nullptr;
  ^
[david@ ~]$ g++5 -std=c++11 test.cpp -o test
[david@ ~]$
 
Is there are way to pass c++flag to compiler globally?
The reason I ask is the program I am trying to build is more than just one cpp. It is a pretty large program that I did not build myself called darkstar a ffxi private server. It uses autotools to build the program. I got all of the required things but no sure if it is possible to build it one cpp at a time or not.
 
Back
Top