error: ‘chrono’ in namespace ‘std’ does not name a type

Breno Leitão picture Breno Leitão · May 21, 2015 · Viewed 12.4k times · Source

Any idea what does this message mean? I am using gcc 4.9 to compile squangle.

In file included from /home/ubuntu/Devel/hhvm/third-party/squangle/squangle/mysql_client/Row.cpp:10:0:
/home/ubuntu/Devel/hhvm/third-party/squangle/src/squangle/mysql_client/Row.h:171:6: error: ‘chrono’ in namespace ‘std’ does not name a type
 std::chrono::system_clock::time_point parseDateTime(StringPiece datetime,
      ^
/home/ubuntu/Devel/hhvm/third-party/squangle/src/squangle/mysql_client/Row.h:174:6: error: ‘chrono’ in namespace ‘std’ does not name a type
 std::chrono::microseconds parseTimeOnly(StringPiece mysql_time,
      ^
/home/ubuntu/Devel/hhvm/third-party/squangle/src/squangle/mysql_client/Row.h:354:6: error: ‘chrono’ in namespace ‘std’ does not name a type
 std::chrono::system_clock::time_point RowBlock::getField(
      ^
/home/ubuntu/Devel/hhvm/third-party/squangle/src/squangle/mysql_client/Row.h:358:6: error: ‘chrono’ in namespace ‘std’ does not name a type
 std::chrono::microseconds RowBlock::getField(size_t row,
      ^
/home/ubuntu/Devel/hhvm/third-party/squangle/squangle/mysql_client/Row.cpp: In member function ‘T facebook::common::mysql_client::RowBlock::getField(size_t, size_t) const [with T = std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1l, 1000000000l> > >; size_t = long unsigned int]’:

Here is part of the code:

std::chrono::system_clock::time_point parseDateTime(StringPiece datetime,
                                                    enum_field_types date_type);

std::chrono::microseconds parseTimeOnly(StringPiece mysql_time,
                                        enum_field_types field_type);

CXX_FLAGS

CXX_FLAGS =  -Wall -std=gnu++11 -ffunction-sections -fno-gcse -fno-omit-frame-pointer -Woverloaded-virtual -Wno-deprecated -Wno-strict-aliasing -Wno-write-strings -Wno-invalid-offsetof -fno-operator-names -Wno-error=array-bounds -Wno-error=switch -Werror=format-security -Wno-unused-result -Wno-sign-compare -Wno-attributes -Wno-maybe-uninitialized -Wno-unused-local-typedefs -fno-canonical-system-headers -Wno-deprecated-declarations -Wno-unused-function  -ftrack-macro-expansion=0 -fno-builtin-memcmp -fno-delete-null-pointer-checks  -Wno-unused-variable -O3 -DNDEBUG -fno-gcse  --param max-inline-insns-auto=100 --param early-inlining-insns=200 --param max-early-inliner-iterations=50 -I/usr/include/powerpc64le-linux-gnu -I/home/ubuntu/Devel/hhvm/third-party/re2/src -I/home/ubuntu/Devel/hhvm/third-party/squangle/src -I/home/ubuntu/Devel/hhvm/third-party/webscalesqlclient/src/include -I/usr/include/libxml2 -I/usr/include/double-conversion -I/usr/include/security -I/home/ubuntu/Devel/hhvm/hphp -I/home/ubuntu/Devel/hhvm/third-party/libzip -I/home/ubuntu/Devel/hhvm/third-party/pcre -I/home/ubuntu/Devel/hhvm/third-party/fastlz -I/home/ubuntu/Devel/hhvm/third-party/timelib -I/home/ubuntu/Devel/hhvm/third-party/libafdt/src -I/home/ubuntu/Devel/hhvm/third-party/libmbfl -I/home/ubuntu/Devel/hhvm/third-party/libmbfl/mbfl -I/home/ubuntu/Devel/hhvm/third-party/libmbfl/filter -I/home/ubuntu/Devel/hhvm/third-party/mcrouter -I/home/ubuntu/Devel/hhvm/third-party/folly -I/home/ubuntu/Devel/hhvm/third-party/thrift -I/home/ubuntu/Devel/hhvm/third-party -I/home/ubuntu/Devel/hhvm -I/home/ubuntu/Devel/hhvm/third-party/squangle

Compiler line:

g++
-DENABLE_FASTCGI=1
-DENABLE_ZEND_COMPAT=1
-DFOLLY_HAVE_CLOCK_GETTIME=1
-DFOLLY_HAVE_FEATURES_H=1
-DFOLLY_HAVE_PTHREAD_ATFORK=1
-DFOLLY_HAVE_PTHREAD_SPINLOCK_T=1
-DFOLLY_HAVE_WEAK_SYMBOLS=1
-DFOLLY_NO_CONFIG=1
-DHAVE_BOOST1_49
-DHAVE_CURL_MULTI_WAIT
-DHAVE_ELF_GETSHDRSTRNDX
-DHAVE_FEATURES_H=1
-DHAVE_LIBDL
-DHHVM
-DHHVM_DYNAMIC_EXTENSION_DIR="/usr/local/lib/hhvm/extensions"
-DHPHP_OSS=1
-DLIBDWARF_USE_INIT_C
-DNDEBUG
-DNO_LIB_GFLAGS
-DNO_TCMALLOC=1
-DPACKAGE=hhvm
-DPACKAGE_VERSION=Release
-DPHP_MYSQL_UNIX_SOCK_ADDR="/var/run/mysqld/mysqld.sock"
-DRELEASE=1
-DTHRIFT_MUTEX_EMULATE_PTHREAD_TIMEDLOCK
-DUSE_EDITLINE
-DUSE_JEMALLOC=1
-D_GNU_SOURCE
-D_PTHREADS=1
-D_REENTRANT=1
-D__STDC_FORMAT_MACROS
-Wall
-std=gnu++11
-ffunction-sections
-fno-gcse
-fno-omit-frame-pointer
-Woverloaded-virtual
-Wno-deprecated
-Wno-strict-aliasing
-Wno-write-strings
-Wno-invalid-offsetof
-fno-operator-names
-Wno-error=array-bounds
-Wno-error=switch
-Werror=format-security
-Wno-unused-result
-Wno-sign-compare
-Wno-attributes
-Wno-maybe-uninitialized
-Wno-unused-local-typedefs
-fno-canonical-system-headers
-Wno-deprecated-declarations
-Wno-unused-function
-ftrack-macro-expansion=0
-fno-builtin-memcmp
-fno-delete-null-pointer-checks
-Wno-unused-variable
-O3
-DNDEBUG
-fno-gcse
--param
max-inline-insns-auto=100
--param
early-inlining-insns=200
--param
max-early-inliner-iterations=50
-I/usr/include/powerpc64le-linux-gnu
-I/home/ubuntu/Devel/hhvm/third-party/re2/src
-I/home/ubuntu/Devel/hhvm/third-party/squangle/src
-I/home/ubuntu/Devel/hhvm/third-party/webscalesqlclient/src/include
-I/usr/include/libxml2
-I/usr/include/double-conversion
-I/usr/include/security
-I/home/ubuntu/Devel/hhvm/hphp
-I/home/ubuntu/Devel/hhvm/third-party/libzip
-I/home/ubuntu/Devel/hhvm/third-party/pcre
-I/home/ubuntu/Devel/hhvm/third-party/fastlz
-I/home/ubuntu/Devel/hhvm/third-party/timelib
-I/home/ubuntu/Devel/hhvm/third-party/libafdt/src
-I/home/ubuntu/Devel/hhvm/third-party/libmbfl
-I/home/ubuntu/Devel/hhvm/third-party/libmbfl/mbfl
-I/home/ubuntu/Devel/hhvm/third-party/libmbfl/filter
-I/home/ubuntu/Devel/hhvm/third-party/mcrouter
-I/home/ubuntu/Devel/hhvm/third-party/folly
-I/home/ubuntu/Devel/hhvm/third-party/thrift
-I/home/ubuntu/Devel/hhvm/third-party
-I/home/ubuntu/Devel/hhvm
-I/home/ubuntu/Devel/hhvm/third-party/squangle
-o
CMakeFiles/squangle.dir/squangle/mysql_client/Row.cpp.o
-c
/home/ubuntu/Devel/hhvm/third-party/squangle/squangle/mysql_client/Row.cpp

Answer

Lightness Races in Orbit picture Lightness Races in Orbit · May 21, 2015

It means squangle doesn't include the proper headers (it does), or your compiler doesn't support std::chrono (it does), or you are not compiling as C++11, using the -std=c++11 switch.