android
What this error means and how to solve it?
I am trying to build a C++ code using NDK in android. I have a method which has a parameter vector < vector <float> > coordinates Everything builds fine until I write this line inside my method vector<float> firstPoint = coordinates.at(0); I start getting this error D:/eclipseworkspace/myLibProject/obj/local/armeabi/libmyLibProject.a(FileName.o): In function `std::priv::_Vector_base<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >::_M_throw_out_of_range() const': D:/androidndk/sources/cxx-stl/stlport/stlport/stl/_vector.c:45: undefined reference to `std::__stl_throw_out_of_range(char const*)' collect2: ld returned 1 exit status make: *** [/cygdrive/d/eclipseworkspace/myLibProject/obj/local/armeabi/libOutputName.so] Error 1 I have no clue why this is happening and Google is not helping either. Thanks.
I think you are using two different implementation of the standard library in the same project. It looks like you are compiling your files with (the headers of) an stlport implementation of the standard library in D:/android..., and you link against your local library. You have to configure the linker in your ide (or Makefile) to use also the lib file of the same implementation (somewhere in D:/android... I guess).
This is a linking error. You need to add APP_STL := stlport_static to your Apllication.mk file. Also make sure that you use -fno-exceptions flag, since STLport is not compatible with C++ exceptions and RTTI. You can get more info in APPLICATION-MK.HTML which is availavle in the docs folder of the NDK. CPLUSPLUS-SUPPORT.HTML is also worth to read.
this looks like a linker error. You probably forgot to add STL library reference to your build. Or it can't be found
Did you do this ? #include <stdexcept> #include <vector> using namespace std;
When I changed vector<float> firstPoint = coordinates.at(0); to vector<float> firstPoint = coordinates[0]; it started compiling..... :s y?
Related Links
notification not firing on particular times in android
non-system libraries in linker flags
Android: items on ListView changes background color after click
Vuforia jPCT integration and build jni
How to mute downlink voice call on android?
Create and use Database in phoneGap is not working
Text to Speech Library Android? [closed]
Actionbar text change while navigating screens
Robolectric: some tests work in Android Studio IDE, but not in Maven
Display Chinese characters from RTF in Android
Is this right way to send JSON data to a web server?
requestLayout() improperly called by android.widget.LinearLayout during layout: running second layout pass
ContentObserver onChange() is not being called.
Missing overflow menu in Android API 10
date and time notification not firing in android
NoClassDefFound Exception on logcat while running the code