繁体   English   中英

当项目依赖使用旧c ++编译的.so库时,使用c ++ 11编译

[英]Compiling with c++11 when project relies on .so libraries compiled with old c++

我正在使用Alderbaran Nao V5机器人。 此外,我正在Virtual Box中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:

等等

在这里可以找到类似的问题: 可以将C ++编译器与同一编译器的不同版本混合使用吗?

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM