android下编译C++(STL)报错

huangxuexiong 2014-09-17 06:11:09
各位大牛们求教啊,小弟刚接触android,目前用C++写了代码,用到了STL,刚开始在A20平台上的android4.2上编译是没有问题的,后来换了平台,三星的4412平台上的android4.0.4上编译就报错了,提示map vector list 等路径找不到。
没有用NDK,是直接在android/external目录下用 mmm编译的
下面放上Android.mk文件及错误提示,希望大牛们可以帮忙啊!跪谢啊!
Android.mk文件内容如下:
LOCAL_PATH:= $(call my-dir)

#clear vars
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

#using stl
LOCAL_SDK_VERSION := 8
#LOCAL_NDK_VERSION := 5
LOCAL_NDK_STL_VARIANT := stlport_static
#LOCAL_NDK_STL_VARIANT := gnustl_static

#include src files
LOCAL_SRC_FILES:= hrproc.cpp hrmain.cpp

#module name
LOCAL_MODULE := hrmain

#add the head file path
#LOCAL_C_INCLUDES :=

#add the static lib file(*.a),in the path system lib
#LOCAL_STATIC_LIBRARIES :=
#add the shared lib file(*.so)
LOCAL_SHARED_LIBRARIES := libhr8000_syslib libhr8000_dblib libhr8000_protocol

#LOCAL_CPPFLAGS := -fPIC
#LOCAL_LDFLAGS := --no-warn-shared-textrel

#build to exe
include $(BUILD_EXECUTABLE)
#build to static lib
#include $(BUILD_STATIC_LIBRARY)
#build to shared lib
#include $(BUILD_SHARED_LIBRARY)
上面用到动态库都可以编译成功

错误提示:
external/hr8000/main/../include/hr8000_dbio.h:13:15: error: map: No such file or directory
external/hr8000/main/../include/hr8000_define.h:30:18: error: vector: No such file or directory
external/hr8000/main/../include/hr8000_define.h:32:16: error: list: No such file or directory
external/hr8000/main/../include/hr8000_define.h:34:18: error: bitset: No such file or directory


...全文
504 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
路人戊戌乙亥 2015-09-24
  • 打赏
  • 举报
回复
找不到有几种原因: a. 你引用stlport库不存在了,可能换了个目录; b. LOCAL_C_INCLUDE 添加的目录不对; 可以尝试作如下: a. 如果你用的是静态链接stlport, 可以找找看那个目录是否存在,CFALGS中 -isystem可以定位查找的目录 b. 如果是用的是动态libstlport 那么先检测系统是否有libstlport.so , 一般在external/stlport下; 然后在LOCAL_C_INCLUDE 中添加stlport的全路径;
huangxuexiong 2014-09-18
  • 打赏
  • 举报
回复
引用 1 楼 youngc527 的回复:
在 Application.mk 里面 APP_STL := gnustl_static 试一下?
试过,一样的错误
Darcy杨 2014-09-17
  • 打赏
  • 举报
回复
在 Application.mk 里面 APP_STL := gnustl_static 试一下?

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧