使用gcc 7.1
[idf fix8]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-7/root/usr --mandir=/opt/rh/devtoolset-7/root/usr/share/man --infodir=/opt/rh/devtoolset-7/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --with-default-libstdcxx-abi=gcc4-compatible --with-isl=/builddir/build/BUILD/gcc-7.1.1-20170526/obj-x86_64-redhat-linux/isl-install --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 7.1.1 20170526 (Red Hat 7.1.1-2) (GCC)
[idf fix8]$
使用此./configure
构建FIX8时[idf fix8]$ ./configure --with-mpmc=tbb --enable-tbbmalloc=yes --enable-f8test=no --enable-rawmsgsupport=yes --enable-doxygen=no --with-precision=single --enable-preencode --enable-bufgloblogging=no --enable-gtest=no
当我运行make时,我会收到这些错误(这很奇怪,因为我告诉它不要构建测试!)
make all-am
make[3]: Entering directory '/home/idf/Documents/c++/fix8/test'
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -I../include -g -O2 -Wall -MT libhftest_la-Perf_types.lo -MD -MP -MF .deps/libhftest_la-Perf_types.Tpo -c -o libhftest_la-Perf_types.lo `test -f 'Perf_types.cpp' || echo './'`Perf_types.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -I../include -g -O2 -Wall -MT libhftest_la-Perf_types.lo -MD -MP -MF .deps/libhftest_la-Perf_types.Tpo -c Perf_types.cpp -fPIC -DPIC -o .libs/libhftest_la-Perf_types.o
In file included from Perf_types.cpp:77:0:
../include/fix8/logger.hpp:576:30: error: 'function' in namespace 'std' does not name a template type
using logger_function = std::function<bool(const std::string&, Logger::Level, const char *, const unsigned)>;
^~~~~~~~
../include/fix8/logger.hpp:580:2: error: 'logger_function' does not name a type; did you mean '__fortify_function'?
logger_function _logger;
^~~~~~~~~~~~~~~
etc...
我已确认使用
构建失败gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC)
我刚刚确认 使用
进行编译gcc version 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC)
并且 编译
gcc version 6.3.1 20170216 (Red Hat 6.3.1-3) (GCC)
请告知。
答案 0 :(得分:1)
您必须在 logger.hpp 中明确#include <functional>
。
原因在https://gcc.gnu.org/gcc-7/porting_to.html中说明:
多个C ++标准库标头已不再更改 包括标题。因此,使用的C ++程序 定义的组件没有明确地包括它 标题将不再编译。
以前的组件如std :: bind和std :: function都是 在包括不相关的标题之后隐式定义,例如&lt;存储器&gt;中 &LT;未来&gt;,&lt;互斥&gt;和&lt;正则表达式取代。正确的代码应该#include &LT;官能&GT;定义它们。