MATLAB mex链接Armadillo
- 下载Armadillo
网站 - 在文件夹\armadillo-10.4.0\examples\lib_win64\内找到libopenblas.dll和libopenblas.lib,复制到源代码所在的文件夹
- 在文件夹armadillo-10.4.0\mex_interface\内找到armaMex.hpp复制到源代码所在文件夹
- 把armadillo-10.4.0全部复源代码制到文件夹同一层目录下,改名为armadillo,这只是为了方便
- 创建源文件hello_world.cpp,
#include “armaMex.hpp”
#include “mex.h”
#include <armadillo>
using namespace arma;
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
mexPrintf(“hello world\n”);
}
- mex编译hello_world.cpp
mex hello_world.cpp -Iarmadillo/include -llibopenblas.lib
- 调用hello_world()