交叉编译包含C和C ++头文件的程序时出错

时间:2016-12-20 07:29:16

标签: c++ c cross-compiling linker-errors

我想使用arm-linux-androideabi-g ++交叉编译包含C和C ++头文件(例如stdio.h和iostream)的程序。

我使用这个命令:

arm-linux-androideabi-g++ --sysroot=/home/user/android/android-ndk-r12b/platforms/android-18/arch-arm  -I /home/user/android/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include -I /home/user/android/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -o demo1 demo.cpp

我收到此错误:

/tmp/ccnVY2tc.o:demo.cpp:function   __static_initialization_and_destruction_0(int, int): error: undefined reference to 'std::ios_base::Init::Init()'

/tmp/ccnVY2tc.o:demo.cpp:function __static_initialization_and_destruction_0(int, int): error: undefined reference to 'std::ios_base::Init::~Init()'

collect2: error: ld returned 1 exit status

我该如何解决这个问题?

0 个答案:

没有答案