【问题标题】:Error when building FIX 8构建 FIX 8 时出错
【发布时间】:2017-10-24 17:44:18
【问题描述】:

使用 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)

请指教。

【问题讨论】:

    标签: gcc7 fix8


    【解决方案1】:

    你必须在 logger.hpp 中明确地#include &lt;functional&gt;

    原因写在https://gcc.gnu.org/gcc-7/porting_to.html:

    几个 C++ 标准库标头已更改为不再 包括标题。因此,使用的 C++ 程序 中定义的组件,但未明确包括 标头将不再编译。

    以前的组件如 std::bind 和 std::function 是 在包含不相关的标头(例如 )后隐式定义, 。正确的代码应该#include 来定义它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-02
      • 2021-07-10
      • 2012-03-30
      • 2019-11-21
      • 2012-03-23
      相关资源
      最近更新 更多