Matlab include files giving compilation errors
Hello,
I have seen many related questions but no one could answer my case I think.
I’m trying to call the Matlab Engine in a cpp code.
I includes the header files in the code and I made the following simple makefile:
Test: Test.cpp
g++ -g Test.cpp -I/matlabroot/extern/include/ -L/matlabroot/extern/bin/maci64/ -lMatlabDataArray -lMatlabEngine -o Test
However the compilation fails. I get a lot of errors and warnings that seem to suggest that the matlab files contain mistakes?
For example I get errors like this:
/matlabroot/extern/include/MatlabDataArray/GetArrayType.hpp:50:61: error: a space is required between consecutive right angle brackets (use ‘> >’)
template<> struct GetArrayType<std::complex<uint16_t>> { static const ArrayType type = ArrayType::COMPLEX_UINT16; };
I think a similar problem was met in this thread: https://www.mathworks.com/matlabcentral/answers/463726-error-with-matlab-engine-data-api-for-c-edit-resolved
In that case it was resolved by changing the Conformance Mode parameter in Visual Studio but I’m using Mac and I don’t know how I should modify my makefile. I couldn’t find much information about what the conformance mode actually means.
Also it’s worth noting that the compilation works fine on Matlab with the command mex. However I plan to add more libraries to my cpp code and I don’t think I can include them from Matlab.
Btw, I’m a physics student and I have very little background in these matters so please excuse me if I’m doing some obvious mistake.Hello,
I have seen many related questions but no one could answer my case I think.
I’m trying to call the Matlab Engine in a cpp code.
I includes the header files in the code and I made the following simple makefile:
Test: Test.cpp
g++ -g Test.cpp -I/matlabroot/extern/include/ -L/matlabroot/extern/bin/maci64/ -lMatlabDataArray -lMatlabEngine -o Test
However the compilation fails. I get a lot of errors and warnings that seem to suggest that the matlab files contain mistakes?
For example I get errors like this:
/matlabroot/extern/include/MatlabDataArray/GetArrayType.hpp:50:61: error: a space is required between consecutive right angle brackets (use ‘> >’)
template<> struct GetArrayType<std::complex<uint16_t>> { static const ArrayType type = ArrayType::COMPLEX_UINT16; };
I think a similar problem was met in this thread: https://www.mathworks.com/matlabcentral/answers/463726-error-with-matlab-engine-data-api-for-c-edit-resolved
In that case it was resolved by changing the Conformance Mode parameter in Visual Studio but I’m using Mac and I don’t know how I should modify my makefile. I couldn’t find much information about what the conformance mode actually means.
Also it’s worth noting that the compilation works fine on Matlab with the command mex. However I plan to add more libraries to my cpp code and I don’t think I can include them from Matlab.
Btw, I’m a physics student and I have very little background in these matters so please excuse me if I’m doing some obvious mistake. Hello,
I have seen many related questions but no one could answer my case I think.
I’m trying to call the Matlab Engine in a cpp code.
I includes the header files in the code and I made the following simple makefile:
Test: Test.cpp
g++ -g Test.cpp -I/matlabroot/extern/include/ -L/matlabroot/extern/bin/maci64/ -lMatlabDataArray -lMatlabEngine -o Test
However the compilation fails. I get a lot of errors and warnings that seem to suggest that the matlab files contain mistakes?
For example I get errors like this:
/matlabroot/extern/include/MatlabDataArray/GetArrayType.hpp:50:61: error: a space is required between consecutive right angle brackets (use ‘> >’)
template<> struct GetArrayType<std::complex<uint16_t>> { static const ArrayType type = ArrayType::COMPLEX_UINT16; };
I think a similar problem was met in this thread: https://www.mathworks.com/matlabcentral/answers/463726-error-with-matlab-engine-data-api-for-c-edit-resolved
In that case it was resolved by changing the Conformance Mode parameter in Visual Studio but I’m using Mac and I don’t know how I should modify my makefile. I couldn’t find much information about what the conformance mode actually means.
Also it’s worth noting that the compilation works fine on Matlab with the command mex. However I plan to add more libraries to my cpp code and I don’t think I can include them from Matlab.
Btw, I’m a physics student and I have very little background in these matters so please excuse me if I’m doing some obvious mistake. matlab engine, c++, compiler MATLAB Answers — New Questions