Search code examples
androidc++compiler-errorsandroid-ndkandroid-stlport

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.


Solution

  • When I changed

    vector<float> firstPoint = coordinates.at(0);
    

    to

    vector<float> firstPoint = coordinates[0];
    

    it started compiling..... :s y?