简体   繁体   English

如何在Matlab 2016b中导入Eigen C ++库?

[英]How to import Eigen C++ library in Matlab 2016b?

Trying to run this command in matlab: 尝试在matlab中运行以下命令:

mex nameofthemainfile.cpp

It throws out the following error: 它抛出以下错误:

Error using mex nameofthemainfile.cpp ...\\source\\NameOfAnotherFile.h(10): fatal error C1083: Cannot open include file: 'Eigen/Core': No such file or directory 使用mex nameofthemainfile.cpp ... \\ source \\ NameOfAnotherFile.h(10)时出错:致命错误C1083:无法打开包含文件:'Eigen / Core':没有此类文件或目录

I am using VS2015 c++ compiler. 我正在使用VS2015 c ++编译器。 Do I need to use another one? 我需要使用另一个吗?

You cannot compile c++ libraries with mex to use them in matlab, but you can write a wrapper (let's say MexEigen.cpp ) where the entry point void mexFunction(...) internally makes use of the Eigen library. 您无法使用mex编译c ++库以在matlab中使用它们,但是您可以编写一个包装器(例如MexEigen.cpp ),其中入口点void mexFunction(...)内部使用了Eigen库。 Then, when compiling it with mex remember to add the include path for Eigen headers: 然后,使用mex进行编译时,请记住为Eigen标头添加包含路径:

mex MexEigen.cpp -I[PATH_TO_EIGEN_INCLUDE]

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

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