=======================
=======================
=======================
NDK의 JNI 에서 std 라이브러리 사용하기
-1-
아래 사진과 같이 path 등록해준다.
${env_var:ANDROID_NDK} <- 부분은 매크로 부분이니 매크로가 설정 되지 않았으면 ndk 설치 경로를 적어주면된다.
-2-
위 사진에 보면 "Application.mk" 파일이 보이는데 이와 파일 내용을 아래와 같이 작성해준다.
또 Android.mk 파일은 기존 쓰던데로 설정해 주면된다.
-- Application.mk -------------------------------------------------------------- FILE
APP_PLATFORM := android-9
APP_OPTIM := release
APP_ABI := armeabi armeabi-v7a
APP_STL := stlport_static
#APP_OPTIM := debug
#APP_ABI := armeabi
-------------------------------------------------------------------------
=======================
=======================
=======================
I'm using eclipse to develop an android app that also uses the ndk. I vectors in my app and I've done the necessary stuff to get them by including
APP_STL := stlport_static
In my Application.mk
Everything is working fine it compiles and runs but Eclipse keeps giving me errors when I use the vectors
std::vector<int> blah
for example creates an error. If I delete the error and keep going it compiles and runs fine.
I've added ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include
In my project config under C++ General -> Paths and Symbols -> include
It resolves #include <vector> fine (before I added the path above I had an error for this) but I still get errors using the vectors.
How can I get eclipse to stop giving me errors for this?
EDIT:
example error: Symbol 'vector' could not be resolved
EDIT 2:
I tried to add
using namespace std;
and then using vector blah and that causes a different error:
Invalid template arguments
2 Answers
Yes, that's it. I've tried to add the same with the same result. However, if you add stl_port headers It will do the trick. Of course it is not necessary to change as it works only in eclipse indexes. It will be usefull until you are going to use something that exists in gnu-libstdc++ and doesn't exist stl-port. |
Blockquote
I am suing eclipse indigo rc2.
I added following line in Android.mk
LOCAL_C_INCLUDES += ${NDKROOT}/sources/cxx-stl/stlport/stlport
and Added following line in Application.mk
APP_STL := stlport_static
then automatically my ndk stlport path added in
Properties -> C++ General -> Paths and Symbols -> include
good luck! ^^
=======================
=======================
=======================
'스마트기기개발관련 > 안드로이드 개발' 카테고리의 다른 글
안드로이드 android 시간 (시, 분, 초) 달력 날짜 관련 (0) | 2020.09.19 |
---|---|
안드로이드 android 유용한 Activity Flag들 Activity 이동, 이전 Activity 알아오기 등등 (0) | 2020.09.19 |
adroid 안드로이드 Activity가 상태 관련 (0) | 2020.09.19 |
android 안드로이드 개발 - 종료 관련 (home, back키) (0) | 2020.09.19 |
android 안드로이드 용량 제한 관련 (0) | 2020.09.19 |