当项目依赖于使用旧c ++

时间:2016-05-27 19:10:31

标签: c++ multithreading c++11 compiler-errors nao-robot

我正在使用Alderbaran Nao V5机器人。此外,我正在虚拟盒子中的Alderbaran虚拟环境中编译我的代码。

我在我的计算机上编写了代码,它依赖于c ++ 11(多线程和匿名函数)的功能,但是,安装在VM上的g ++编译器是:

  Using built-in specs.
COLLECT_GCC=/usr/i686-pc-linux-gnu/gcc-bin/4.5.3/g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.5.3/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /opennao-atom/tmp/portage/sys-devel/gcc-4.5.3-r1/work/gcc-4.5.3/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.5.3 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.5.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.5.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.5.3/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --disable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/i686-pc-linux-gnu/4.5.3/python --enable-checking=release --disable-libgcj --with-arch=i686 --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.3-r1 p1.0, pie-0.4.5'
Thread model: posix
gcc version 4.5.3 (Gentoo 4.5.3-r1 p1.0, pie-0.4.5)

因为原型-std = c ++ 0x标志可以使用多线程和匿名函数,所以我尝试在启用c ++ 0x的情况下进行编译。但是,我收到以下错误消息,我假设发生,因为我在我的代码中使用的Alderbaran库符合为早期c ++版本指定的规则。有谁能推荐一个解决方案?有没有办法使用Alderbaran库的向后兼容性,但是在我的代码中使用新的编译器?

g++ -Wall -g -fPIC -std=c++0x -c -I/home/nao/naoqi-sdk-2.1.3.3-linux32/include StepHandler.cpp
In file included from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodule.h:17:0,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alproxy.h:16,
                 from StepHandler.h:16,
                 from StepHandler.cpp:6:
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/boost/signal.hpp:17:4: warning: #warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING."
In file included from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodulecore.h:17:0,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodule.h:16,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alproxy.h:16,
                 from StepHandler.h:16,
                 from StepHandler.cpp:6:
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/boost/noncopyable.hpp:27:37: error: 'boost::noncopyable_::noncopyable::noncopyable()' declared with non-public access cannot be defaulted in the class body
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/boost/noncopyable.hpp:28:22: error: 'boost::noncopyable_::noncopyable::~noncopyable()' declared with non-public access cannot be defaulted in the class body
In file included from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/typeinterface.hpp:371:0,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/anyfunction.hpp:53,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/manageable.hpp:13,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/anyobject.hpp:17,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alfunctor.h:17,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodulecore.h:21,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodule.h:16,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alproxy.h:16,
                 from StepHandler.h:16,
                 from StepHandler.cpp:6:
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/typeimpl.hxx: In static member function 'static void* qi::TypeByPointer<T, Manager>::initializeStorage(void*)':
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/typeimpl.hxx:157:1: error: too few arguments to function 'boost::format qi::log::detail::getFormat(const std::string&)'
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qi/details/log.hxx:201:28: note: declared here
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/typeimpl.hxx:157:1: error: expected primary-expression before '(' token
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/typeimpl.hxx:157:1: error: too few arguments to function 'boost::format qi::log::detail::getFormat(const std::string&)'
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qi/details/log.hxx:201:28: note: declared here
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/typeimpl.hxx:157:1: error: expected primary-expression before ')' token
In file included from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/typeinterface.hpp:372:0,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/anyfunction.hpp:53,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/manageable.hpp:13,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/anyobject.hpp:17,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alfunctor.h:17,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodulecore.h:21,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodule.h:16,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alproxy.h:16,
                 from StepHandler.h:16,
                 from StepHandler.cpp:6:
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/type.hxx: In function 'void qi::detail::initializeType(qi::TypeInterface*&)':
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/type.hxx:46:1: error: too few arguments to function 'boost::format qi::log::detail::getFormat(const std::string&)'
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qi/details/log.hxx:201:28: note: declared here
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/type.hxx:46:1: error: expected primary-expression before '(' token
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/type.hxx:46:1: error: too few arguments to function 'boost::format qi::log::detail::getFormat(const std::string&)'
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qi/details/log.hxx:201:28: note: declared here
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/type.hxx:46:1: error: expected primary-expression before ')' token
In file included from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/typeinterface.hpp:376:0,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/anyfunction.hpp:53,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/manageable.hpp:13,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/anyobject.hpp:17,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alfunctor.h:17,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodulecore.h:21,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodule.h:16,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alproxy.h:16,
                 from StepHandler.h:16,
                 from StepHandler.cpp:6:
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/stringtypeinterface.hxx: In member function 'virtual void qi::TypeImpl<char [I]>::set(void**, const char*, size_t)':
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/stringtypeinterface.hxx:104:1: error: too few arguments to function 'boost::format qi::log::detail::getFormat(const std::string&)'
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qi/details/log.hxx:201:28: note: declared here
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/stringtypeinterface.hxx:104:1: error: expected primary-expression before '(' token
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/stringtypeinterface.hxx:104:1: error: expected primary-expression before ',' token
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/stringtypeinterface.hxx:104:1: error: too few arguments to function 'boost::format qi::log::detail::getFormat(const std::string&)'
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qi/details/log.hxx:201:28: note: declared here
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/stringtypeinterface.hxx:104:1: error: expected primary-expression before ')' token
In file included from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/typeinterface.hpp:380:0,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/anyfunction.hpp:53,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/manageable.hpp:13,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/anyobject.hpp:17,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alfunctor.h:17,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodulecore.h:21,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodule.h:16,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alproxy.h:16,
                 from StepHandler.h:16,
                 from StepHandler.cpp:6:
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/dynamictypeinterface.hxx: In member function 'virtual qi::AnyReference qi::TypeImpl<boost::any>::get(void*)':
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/dynamictypeinterface.hxx:20:1: error: too few arguments to function 'boost::format qi::log::detail::getFormat(const std::string&)'
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qi/details/log.hxx:201:28: note: declared here
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/dynamictypeinterface.hxx:20:1: error: expected primary-expression before '(' token
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/dynamictypeinterface.hxx:20:1: error: too few arguments to function 'boost::format qi::log::detail::getFormat(const std::string&)'
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qi/details/log.hxx:201:28: note: declared here
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/dynamictypeinterface.hxx:20:1: error: expected primary-expression before ')' token
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/dynamictypeinterface.hxx: In member function 'virtual void qi::TypeImpl<boost::any>::set(void**, qi::AnyReference)':
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/dynamictypeinterface.hxx:26:1: error: too few arguments to function 'boost::format qi::log::detail::getFormat(const std::string&)'
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qi/details/log.hxx:201:28: note: declared here
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/dynamictypeinterface.hxx:26:1: error: expected primary-expression before '(' token
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/dynamictypeinterface.hxx:26:1: error: too few arguments to function 'boost::format qi::log::detail::getFormat(const std::string&)'
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qi/details/log.hxx:201:28: note: declared here
/home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/details/dynamictypeinterface.hxx:26:1: error: expected primary-expression before ')' token
In file included from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/anyfunction.hpp:228:0,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/manageable.hpp:13,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/qitype/anyobject.hpp:17,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alfunctor.h:17,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodulecore.h:21,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/almodule.h:16,
                 from /home/nao/naoqi-sdk-2.1.3.3-linux32/include/alcommon/alproxy.h:16,
                 from StepHandler.h:16,
                 from StepHandler.cpp:6:

2 个答案:

答案 0 :(得分:1)

可以在此处找到类似的问题:Can you mix c++ compiled with different versions of the same compiler

最安全的解决方案是对应用程序代码和库使用相同的编译器版本。这意味着使用新的编译器版本重新编译您正在使用的所有库。

答案 1 :(得分:0)

请注意,对于NAO,您还可以交叉编译C ++,因此无需使用虚拟机,因此您可以使用您想要的任何编译器版本!