我使用了mathworks网站的示例代码,通过a link将MATLAB代码与C/C++集成在一起!MATLAB代码和C/C++集成的致命错误
正如你在代码中看到,有头文件为: #include "engine.h"
在Linux操作系统(Ubuntu的),我跑: g++ engdemo.cpp -o mycpp
命令来创建一个可执行程序,但发生以下致命错误:
engdemo.cpp:14:20: fatal error: engine.h: No such file or directory, compilation terminated.
我该如何解决这个致命错误?
是否'engine.h'文件存在于当前目录? –
@BlueBit:你需要告诉编译器在哪里可以找到头文件。您还需要链接所需的库。文档解释了这一点:http://www.mathworks.com/help/matlab/matlab_external/compiling-engine-applications-with-the-mex-command.html,http://www.mathworks.com/support/solutions/en/data/1-1BSZR/ – Amro