I am trying to build a program called darkstar a private FFXI server. I am trying to build this on FreeBSD 10.2 stable. I am using GCC 5.3 from ports to try to build this.
Using this make CC=gcc5 CXX=g++5 CPP="gcc5 -E" to call the correct version of GCC/G++.
This is the error code I get kicked out.
src/common/../common/../common/cbasetypes.h:336:22: error: 'chrono_literals' is not a namespace-name
using namespace std::chrono_literals;
^
src/common/../common/../common/cbasetypes.h:336:37: error: expected namespace-name before ';' token
using namespace std::chrono_literals;
I have checked to make sure that chrono is actually in the correct spot which it is it is at /usr/include/c++/v1/chrono.
Where the error is getting thrown this is the code that is from the line 336 in cbasetypes.h and the few lines after.
#include <chrono>
using namespace std::chrono_literals;
using server_clock = std::chrono::steady_clock;
using time_point = server_clock::time_point;
using duration = server_clock::duration;
Not sure what to do to work around this error though I figured this community would be a good place to start.
You misspelt std::literals::chrono_literals
.
Remember to ensure that you're compiling the source according to C++14 (the chrono literals are not provided in C++11).
This works for me:
using namespace std::literals::chrono_literals;
And add this in the CMakeLists.txt
:
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
#include <chrono>
using namespace std::chrono_literals;
will do, but you will need at least the C++14 compilation flag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With