android external/stlport include in Android.mk build not successfull

笑着哭i 提交于 2019-12-04 16:04:57

As I understand the file which cannot be found by preprocessor is located in bionic folder.

I had the same issue and I solved it by adding the following line:

LOCAL_C_INCLUDES += bionic

I haven't tried this with Android 2.2 but I'm using Android Kitkat (4.4).

To get the stlport library working with our project we included it in our project's Android.mk as so:

include external/stlport/libstlport.mk

This is assuming that on Froyo, there is a libstlport.mk file to include in your build process. In 4.4, there is also a Android.mk file but that builds other code as well and builds stlport as a static library (which is not what we wanted).

You may need to also add the include directory as well, something like: external/stlport/stlport.

cpp
#include <stdio.h>
// The code 
// The set of definitions and includes for STLPort 
// They used defined() instead of #ifdef. 
#define _STLP_HAS_INCLUDE_NEXT  1 
#define _STLP_USE_MALLOC   1 
#define _STLP_USE_NO_IOSTREAMS  1 
#include <stl/config/_android.h> 
#include <map>
#include <string> 

int main(void)
{
    std::string a = "abc";
    printf("%s",a.c_str());
    return 0;
}

Android.mk
# A simple test for the minimal standard C++ library
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := test-libstl.cpp
LOCAL_C_INCLUDES += sources/cxx-stl/stlport/stlport
LOCAL_SHARED_LIBRARIES += libstlport 
LOCAL_MODULE := test-libstl
include $(BUILD_EXECUTABLE)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!