Debian系统中如何将matlab编译好的代码集成到c++中

how to integrate matlab compiled code into c++ in Debian system

我一直在尝试使用Matlab 编译器SDK 将我的Matlab 程序打包为Debian 系统中的C++ 共享库。我得到的文件夹包括test.c、test.h、test.so(test是我的Matlab程序名),我在Debian系统中安装了Matlab_runtime。我已经根据 readme.txt 中的要求设置了变量 LD_LIBRARY_PATH_ 和 _ XAPPLRESDIR_ _ *( _ 将 MCR_ROOT 替换为 MATLAB 运行时所在的目录安装在目标机器上。 (1) 设置环境变量XAPPLRESDIR为这个值: MCR_ROOT/v91/X11/app-defaults (2) 如果环境变量LD_LIBRARY_PATH未定义,将其设置为以下字符串的串联: MCR_ROOT/v91/runtime/glnxa64: MCR_ROOT/v91/bin/glnxa64: MCR_ROOT/v91/sys/os/glnxa64: MCR_ROOT/v91/sys/opengl/lib/glnxa64_)* . 我编辑 main.cpp 包括 test.h。当我尝试使用 _ gcc main.cpp -o main_ 编译 main.cpp 时,出现如下错误: 在 main.cpp:2:0 包含的文件中: test.h:15:22: 胎儿错误: mclmcrrt.h: 没有那个文件或目录 #include "mclmcrrt.h"

I know that mclmcrrt.h is in the package of Matlab_runtime, it means I failed to link to the library of Matlab_runtime. Anybody knows what should I do to make my main.cpp compile successfully? I tried two days to work on how to connect to the Matlab_runtime library, but still failed. I am a beginner to linux. Great thanks if anyone can help.

这是编译问题,不是链接问题。您的编译器不知道 mclmcrrt.h 在哪里。请告诉它它在哪里,帮助它找到它:

gcc -I<the_folder_where_mclmcrrt.h_lives_in> ...