1

I used a sample code from mathworks website to integrate a MATLAB code with C/C++ by a link!

As you seen in the code, there is header file as: #include "engine.h"

In Linux (Ubuntu), I ran: g++ engdemo.cpp -o mycpp command to create an executable program, but the below fatal error occurred:

engdemo.cpp:14:20: fatal error: engine.h: No such file or directory, compilation terminated.

How can i solve this fatal error?

2

1 Answer 1

2

Look in

[matlabroot '/extern/include']

If you see engine.h there, just run

g++ -I../../include engdemo.cpp -o mycpp 

(assuming you run from [matlabroot '/extern/examples/eng_mat/'])

Sign up to request clarification or add additional context in comments.

1 Comment

There is an error when run: g++ -I /usr/local/MATLAB/R2011b/extern/include engdemo.cpp -o mycpp : /tmp/ccNSRT82.o: In function main': engdemo.cpp:(.text+0x4c): undefined reference to engOpen' engdemo.cpp:(.text+0xa7): undefined reference to mxCreateDoubleMatrix' engdemo.cpp:(.text+0xb7): undefined reference to mxGetPr' engdemo.cpp:(.text+0x141): undefined reference to engPutVariable' engdemo.cpp:(.text+0x155): undefined reference to engEvalString' engdemo.cpp:(.text+0x169): undefined reference to engEvalString' engdemo.cpp:(.text+0x17d): undefined reference to engEvalString' ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.