在构建C++项目时提升相关错误

Boost related errors while building a C++ project

本文关键字:错误 构建 C++ 项目      更新时间:2023-10-16

我正在尝试构建一个用C++(https://sourceforge.net/p/open-chicken-invaders/code/HEAD/tree/trunk/(编写的旧游戏的克隆,但我遇到了一些无法解决的与 Boost 相关的错误。我尝试在Windows,Ubuntu和Raspberry Pi上构建这个项目,但每次都遇到相同的错误。开发人员处于非活动状态,我无法联系他。

pi@raspberrypi:~ $ cd openci
pi@raspberrypi:~/openci $ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o audio/controller_holder.o -c "`sdl2-config --cflags`" -Wextra -I. -DUSE_BOOST_CHRONO -DBOOST_SP_DISABLE_THREADS -DTIXML_USE_STL -O3 -DNDEBUG audio/controller_holder.cpp
In file included from ./context/objects_storage.h:27:0,
                 from ./objects/base/object.h:24,
                 from ./objects/base/active.h:24,
                 from audio/controller_holder.h:24,
                 from audio/controller_holder.cpp:22:
/usr/include/boost/move/detail/type_traits.hpp:1059:4: error: 'Align' is not a type
    BOOST_STATIC_ASSERT(Align > 0);
    ^
/usr/include/boost/move/detail/type_traits.hpp:1059:4: error: expected ',' or '...' before '>' token
    BOOST_STATIC_ASSERT(Align > 0);
    ^
./portability/cpp11.h:29:75: error: ISO C++ forbids declaration of 'BOOST_STATIC_ASSERT' with no type [-fpermissive]
 #   define static_assert(condition, message) BOOST_STATIC_ASSERT(condition)
                                                                           ^
/usr/include/boost/move/detail/type_traits.hpp:1064:4: error: 'value' is not a type
    BOOST_STATIC_ASSERT(value >= Align);
    ^
/usr/include/boost/move/detail/type_traits.hpp:1064:4: error: expected ',' or '...' before '>=' token
    BOOST_STATIC_ASSERT(value >= Align);
    ^
./portability/cpp11.h:29:75: error: ISO C++ forbids declaration of 'BOOST_STATIC_ASSERT' with no type [-fpermissive]
 #   define static_assert(condition, message) BOOST_STATIC_ASSERT(condition)
                                                                           ^
./portability/cpp11.h:29:46: error: 'int boost::move_detail::aligned_storage<Len, Align>::BOOST_STATIC_ASSERT(int)' cannot be overloaded
 #   define static_assert(condition, message) BOOST_STATIC_ASSERT(condition)
                                              ^
./portability/cpp11.h:29:46: error: with 'int boost::move_detail::aligned_storage<Len, Align>::BOOST_STATIC_ASSERT(int)'
 #   define static_assert(condition, message) BOOST_STATIC_ASSERT(condition)
                                              ^
/usr/include/boost/move/detail/type_traits.hpp:1065:4: error: expected identifier before '(' token
    BOOST_STATIC_ASSERT((value % Align) == 0);
    ^
/usr/include/boost/move/detail/type_traits.hpp:1065:4: error: expected ')' before '%' token
    BOOST_STATIC_ASSERT((value % Align) == 0);
    ^
/usr/include/boost/move/detail/type_traits.hpp:1065:4: error: expected ')' before '%' token
/usr/include/boost/move/detail/type_traits.hpp:1065:4: error: expected ';' at end of member declaration
    BOOST_STATIC_ASSERT((value % Align) == 0);
    ^
/usr/include/boost/move/detail/type_traits.hpp:1065:4: error: expected unqualified-id before '%' token    BOOST_STATIC_ASSERT((value % Align) == 0);
    ^
scons: *** [audio/controller_holder.o] Error 1
scons: building terminated because of errors.
pi@raspberrypi:~/openci $

我在其他地方读到过 Boost 未正确配置。我已经使用 apt-get install libboost1.62-all 安装了它。(在树莓派 3 上(。

我能做什么?

该项目使用

gcc 4.6boost 1.58 编译得很好。