我有一个名为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.
您是否正在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"