"fatal error: Eigen/Dense: No such file or directory" // 本征库
"fatal error: Eigen/Dense: No such file or directory" // Eigen Library
我在Windows 8.1上使用Java-Eclipse Luna进行Android编程,我也在使用本机环境(C++)。我正在尝试在我的本机代码中使用特征库。我收到"致命错误:特征/密集:没有这样的文件或目录"错误,我不知道背后的原因。这是我的代码:
我的.java文件:
package com.example.androideignv2;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class AndroidEignV2Activity extends ActionBarActivity {
/** Loading the Native library */
static {
/** Use either of the following two methods to load the native library*/
System.loadLibrary("myNativeLibrary");
//System.load("/data/data/cookbook.chapter2/lib/libNativeRegister.so");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_android_eign_v2);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.android_eign_v2, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
我的.cpp原生库:
#include <jni.h>
#include <android/log.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main() // int argc, char* argv[]
{
MatrixXd m = MatrixXd::Random(3,3);
m = (m + MatrixXd::Constant(3,3,1.2)) * 50;
cout << "m =" << endl << m << endl;
VectorXd v(3);
v << 1, 2, 3;
//cout << "m * v =" << endl << m * v << endl;
}
我的 Android.mk 文件:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := myNativeLibrary
LOCAL_SRC_FILES := myNativeLibrary.cpp
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
我的 Application.mk 文件:
APP_ABI := all
APP_STL:=stlport_static
我通过以下方式将特征库文件夹包含在"路径和符号"中:项目/属性/C/C++ 常规/路径和符号/包含/然后我浏览到我的特征库路径。
任何提示都将深表赞赏
您只将 Eigen 库包含文件夹添加到 Eclipse 路径和符号中。
从实际 NDK 构建中引用此库是您必须执行的不同步骤。你们的图书馆是如何组织的?它已经为安卓编译了吗?
您可以从 Android.mk 中引用此类第三方预构建的 NDK 库。将出现的.so
和SHARED
替换为.a
,如果您拥有的是静态预构建库而不是共享库,则STATIC
:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := eigen
LOCAL_SRC_FILES := /path/to/eigen/prebuilts/$(TARGET_ARCH_ABI)/libeigen.so
LOCAL_EXPORT_C_INCLUDES := /absolute/path/to/includes
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := myNativeLibrary
LOCAL_SRC_FILES := myNativeLibrary.cpp
LOCAL_SHARED_LIBRARIES := eigen
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
相关文章:
- Android NDK clang 编译器错误在 Windows 上显示'No such file or directory'
- 已解决 - C++ 的崇高文本中的"fatal error: opencv: no such file or directory"
- "No such file or directory" C++标头问题
- 我在 #include < bits/stdc++h.> 放置时出错"No such file or directory"
- 叮叮当当。target_include_directories "No such file or directory"
- 从生成文件编译错误:"Unable to open output file" ..."No such file or directory"
- C++编译期间出现"No such file or directory"错误
- 尝试编译 TensorFlow 时出错"/system/bin/linker: No such file or directory"
- 代码块中的哈希库++库"No such file or directory"错误
- 成功使用CMakeLists制作后如何修复"open: No such file or directory"错误(该文件实际上存在)
- 如何在安装了 WSL 的 Visual Studio Code 中修复"g++: error: helloworld.cpp: No such file or directory"?
- 尝试使用生成文件编译程序时"fatal error: boost/regex.hpp: No such file or directory" C++
- SDL 测试程序 - "No such file or directory"
- GDB 列表错误"No such file or directory"
- 我的文件可以编译,但当我尝试运行它时"no such file or directory"
- 无法使用 Qt: "No such file or directory" 打开包含文件
- 如何修复"fatal error: boost/asio.hpp: no such file or directory"?
- ": No such file or directory"执行外壳文件
- 在 Netbeans 8.2、c++ "No such file or directory"(初学者)中运行失败
- 使用TensorFlow时"unsupported/Eigen/CXX11/Tensor: No such file or directory"