0

I trying to include mlpack c++ library into my android project but getting an error when using some function of mlpack like:

NeighborSearch<NearestNeighborSort, ManhattanDistance> nn(data);

Error:

> undefined reference to `mlpack::Log::Assert(bool, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
> clang++: error: linker command failed with exit code 1 (use -v to see
> invocation) ninja: build stopped: subcommand failed

Could you please help me step by step to resolve this issue?

Monir Zzaman
  • 459
  • 4
  • 7
  • What have you tried? What problems did you encounter? – Alan Birtles Feb 15 '22 at 07:15
  • I included mlpack, boost, and armadillo under src/main/cpp/include & all files are now getting each other but the problem is the following error when trying to build the project: D:/DummyProject/MlPackBuild/app/src/main/cpp/include\mlpack/core/tree/hrectbound_impl.hpp:230: undefined reference to `mlpack::Log::Assert(bool, std::__ndk1::basic_string, std::__ndk1::allocator > const&)' clang++: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. – Monir Zzaman Feb 15 '22 at 16:26
  • Please [edit](https://stackoverflow.com/posts/71122249/edit) this into the question, comments are poor for formatting – Alan Birtles Feb 15 '22 at 17:03
  • Have you linked to the mlpack libraries? Is mlpack compiled with the same standard library as your project? – Alan Birtles Feb 16 '22 at 07:41
  • Where need to link? I put it inside src/main/cpp/include/mlpack and linked it as : include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) into CMakeLists.txt – Monir Zzaman Feb 17 '22 at 08:54
  • 1
    you need to link to the library – Alan Birtles Feb 17 '22 at 09:22

0 Answers0