包含iostream时会显示未定义的引用

时间:2012-03-22 21:22:42

标签: android c++ android-ndk

我曾尝试为android编译非常简单的代码:

#include <iostream>

void foo()
{
}

但是我收到了一些链接错误:

/home/l/android-ndk-r7b/sources/cxx-stl/gnu-libstdc++/include/iostream:72: undefined reference to `std::ios_base::Init::Init()'
/home/l/eclipse_workspace/android_bt_test1/jni/native.cpp:33: undefined reference to `std::ios_base::Init::~Init()'

我的Application.mk是:

APP_OPTIM := debug
APP_MODULES := native_lab
APP_STL := gnustl_static

我的Android.mk是:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := native_lab
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_SRC_FILES := native.cpp
LOCAL_LDLIBS := -ldl -lstdc++ -llog
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include /home/l/android-ndk-r7b/sources/cxx-stl/gnu-libstdc++/include/ /home/l/android-ndk-r7b/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include
include $(BUILD_SHARED_LIBRARY)

我知道这个问题很简单,但我找不到解决方法。 请问有人帮帮我吗?

0 个答案:

没有答案