简体   繁体   English

Android NDK包含本征

[英]Android NDK Include Eigen

I am trying to include the Eigen3 library in an Android project so I can do some Matrix math in native code. 我试图将Eigen3库包含在Android项目中,以便可以在本机代码中进行一些Matrix数学运算。

When I compile my project it complains: 当我编译项目时,它抱怨:

In file included from jni/Eigen/Dense:1:0,
                 from jni/Ares.cpp:9:
jni/Eigen/Core:156:22: fatal error: functional: No such file or directory
 #include <functional>
                      ^
compilation terminated.

I thought maybe including the STL would help, so I have an Application.mk file which is as follows: 我认为也许包括STL会有所帮助,所以我有一个Application.mk文件,如下所示:

APP_STL := gnustl_static

No dice, though. 不过没有骰子。

Adding /usr/include/c++/4.9.2/ to my LOCAL_C_INCLUDES variable resolves that error, but raises: /usr/include/c++/4.9.2/添加到我的LOCAL_C_INCLUDES变量可解决该错误,但会引发:

In file included from jni/Eigen/Core:152:0,
                 from jni/Eigen/Dense:1,
                 from jni/Ares.cpp:9:
/usr/include/c++/4.9.2/cstdlib:41:28: fatal error: bits/c++config.h: No such file or directory
 #include <bits/c++config.h>

Is there a way to include Eigen and resolve these issues other than progressively adding most of my machine's headers? 除了逐步添加我的机器的大多数标头之外,是否可以包含Eigen并解决这些问题?

The following resolved the aforementioned issue! 以下解决了上述问题!

  1. Create a file called Application.mk in the directory projet_dir/jni/ (so it is projet_dir/jni/Application.mk ). 在目录projet_dir/jni/创建一个名为Application.mk的文件(因此它是projet_dir/jni/Application.mk )。

  2. Add the following line to that file 将以下行添加到该文件

     APP_STL:=stlport_static 
  3. If you run into a shared_ptr error, try using APP_STL := gnustl_static instead. 如果遇到shared_ptr错误,请尝试改用APP_STL := gnustl_static

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM