本文介绍了Android的NDK包括艾根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想包括在Android项目库,所以我可以做一些矩阵数学在本地code。

I am trying to include the Eigen3 library in an Android project so I can do some Matrix math in native code.

当我编译我的项目,它抱怨:

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.

我想也许包括STL会有所帮助,所以我有一个 Application.mk 文件,该文件如下:

APP_STL := gnustl_static

没有骰子,虽然。

添加 / usr / include目录/ C ++ / 4.9.2 / 我的 LOCAL_C_INCLUDES 变量解决了错误,但提出了:

Adding /usr/include/c++/4.9.2/ to my LOCAL_C_INCLUDES variable resolves that error, but raises:

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?

推荐答案

下面的解决上述问题!


  1. 创建一个名为 Application.mk 目录 projet_dir / JNI / 文件(所以它是 projet_dir / JNI / Application.mk )。

  1. Create a file called Application.mk in the directory projet_dir/jni/ (so it is projet_dir/jni/Application.mk).

以下行添加到该文件

APP_STL:=stlport_static


  • 如果你碰到一个shared_ptr错误,请尝试使用 APP_STL:= gnustl_static 而不是

    这篇关于Android的NDK包括艾根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 09-26 13:44