Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble w/ std::string when building C++ code in ndk environment

Tags:

android-ndk

I'm working on some code cuz I was asked to devlep c++ code about core part of a program. But, it's my first time to use ndk so, I had some troubles and resolved that. However, too difficult problem is coming to me. I had building my c++ code w/ ndk but, it said,

.h:3:20: error: string: No such file or directory .h:5: error: 'std::string' has not been declared

and any other errors about that. Below is my 'Android.mk' file I wrote:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE    := clibs
LOCAL_SRC_FILES := sqlite3.c
LOCAL_LDLIBS    := -llog
include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_DEFAULT_CPP_EXTENSION := cpp
LOCAL_MODULE    := mytweetlib
LOCAL_STATIC_LIBRARIES := clibs
LOCAL_SRC_FILES := Friend.cpp SQLiteDB.cpp Cursor.cpp DB4Friends.cpp ResultParser.cpp MyTweet.cpp Stub.cpp
include $(BUILD_SHARED_LIBRARY) 

I tried to link the .c file(sqlite3.c) Making static library file w/ the other file(to be built to shared library). Is there anyone knows about this? Even if it's just very little clue, plz give me that. (I haven't been resolving this problem)

like image 664
Nickey Avatar asked Mar 23 '26 08:03

Nickey


1 Answers

It looks like the NDK isn't being told to use stl port.

Try adding an Application.mk file containing APP_STL. This adds the stlport headers to the include path, and links against the libraries.

APP_STL := stlport_static
like image 149
Piklor Avatar answered Mar 26 '26 13:03

Piklor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!