我试图将一个大型项目,这使得大量使用C++ 11功能,到树莓派。该项目使用CMAKE,我正在使用crosstool-ng进行交叉编译。我在Pi上安装了依赖关系并将它们复制到本地,并且我设法让CMAKE找到它们。一些代码正确构建并生成ARM输出。但是,大部分代码都会因混乱的GCC输出而失败,我相当肯定与C++ 11 /模板支持有关。例如,我得到的错误是这样的:交叉编译Raspberry Pi的C++ 11代码
error: 'mutex' in namespace 'std' does not name a type
(有问题的文件包括<线程>这个错误消失,如果我还包括<互斥>,而不是在x86 Ubuntu的一个要求)error: expected class-name before '{' token
(前行{是:template<typename _Res> class __basic_future : public std::__future_base
)error: '__result_type' does not name a type
(这可能发生,因为上述错误的)
这些错误看起来像ARM g ++编译器不太喜欢模板。正在使用的g ++版本是arm-unknown-linux-gnueabi-g++ (crosstool-NG 1.18.0) 4.7.3 20130102 (prerelease)
。
任何人都可以指向正确的方向吗?
编辑:这里是G ++看起来像在ps
的文件之一:
arm-unknown-linux-gnueabi-g++ -DprojectCore_EXPORTS -fPIC
-I/home/sagar/workspace/RaspberryPi/target_env/usr/include
-I/home/sagar/workspace/RaspberryPi/target_env/usr/include/freetype2
-I/home/sagar/workspace/RaspberryPi/target_env/usr/include/glib-2.0
-I/home/sagar/workspace/RaspberryPi/target_env/usr/lib/arm-linux-gnueabihf/glib-2.0/include
-I/home/sagar/workspace/RaspberryPi/target_env/usr/include/gdk-pixbuf-2.0
-I/home/sagar/workspace/RaspberryPi/target_env/usr/include/gtk-2.0
-I/home/sagar/workspace/RaspberryPi/target_env/usr/lib/arm-linux-gnueabihf/gtk-2.0/include
-I/home/sagar/workspace/RaspberryPi/target_env/usr/include/cairo
-I/home/sagar/workspace/RaspberryPi/target_env/usr/include/pango-1.0
-I/home/sagar/workspace/RaspberryPi/target_env/usr/include/atk-1.0
-I/home/sagar/workspace/RaspberryPi/target_env/usr/local/include
-I/home/sagar/workspace/RaspberryPi/target_env/usr/include/eigen3
-I/home/sagar/workspace/RaspberryPi/target_env/usr/include/flann
-I/home/sagar/workspace/project/include -std=c++0x -Wall -Werror -Wno-deprecated -fPIC -g -O4
-o CMakeFiles/projectCore.dir/src/project/Core/Memory/Array2D.C.o -c /home/sagar/workspace/project/src/project/Core/Memory/Array2D.C
'-std = C++ 11'也许? –
@BartekBanachewicz我添加了为其中一个文件生成的g ++命令。 -std = C++ 0x就在那里,我认为这和C++ 11在这一点上是一样的。 – sagargp
'std :: mutex'应该在''(或[因此它在这里说](http://en.cppreference.com/w/cpp/thread/mutex))中定义,所以我不认为这是一个错误 - 如果有什么错误的是,x86版本包含你没有要求的头文件,但我不记得在什么程度上允许。但是加入它不会破坏x86吗?你有#包括''为其他? –
Rup