如何使用64位MinGW和32位Matlab在Windows的gcc搜索路径中包括“ matlabengine.hpp”和“ MatlabDataArray.hpp”文件?

问题描述 投票:0回答:1

我有一个名为call_mat.cpp的文件,其开头有两个语句:

\#include "MatlabDataArray.hpp" and    \#include "MatlabEngine.hpp"

These headers files are not on "gcc" default search path. They are in the folder "C:/Programmes/MATLAB/R2018a/extern/include". I tried the "-I" option to include them when running my code using the following command:

gcc -c -I/C:/Programmes/MATLAB/R2018a/extern/include call_mat.cpp

我收到以下错误:

call_mat.cpp:1:10: fatal error: MatlabDataArray.hpp: No such file or directory
    1 | #include "MatlabDataArray.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
c++ matlab gcc mingw matlab-engine
1个回答
0
投票

您是否正在MSYS2 shell下执行此操作?如果是这样,您应该使用:

-IC:/Programmes/MATLAB/R2018a/extern/include

或:

-I/C/Programmes/MATLAB/R2018a/extern/include

或者甚至:

-I'C:\Programmes\MATLAB\R2018a\extern\include'

如果您不使用任何类型的* nix类外壳(或普通的命令提示符或PowerShell),则可以使用:

-I "C:\Programmes\MATLAB\R2018a\extern\include"
© www.soinside.com 2019 - 2024. All rights reserved.