I am trying to configure eclipse to compile and run the example engdemo.cpp
, that uses the matlab engine.
I followed the instructions written here, but I have still errors:
make all
Building target: matlabEngine
Invoking: GCC C++ Linker
g++ -L/usr/local/MATLAB/R2011a/bin/glnx86 -Xlinker -rpath-link -Xlinker /usr/local/MATLAB/R2011a/bin/glnx86 -o"matlabEngine" ./engdemo.o -leng -lm -lmat -lmex -lut
/usr/bin/ld: ./engdemo.o: undefined reference to symbol 'mxDestroyArray'
/usr/bin/ld: note: 'mxDestroyArray' is defined in DSO /usr/local/MATLAB/R2011a/bin/glnx86/libmx.so so try adding it to the linker command line
/usr/local/MATLAB/R2011a/bin/glnx86/libmx.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [matlabEngine] Errore 1
When I compile the program from the shell I use these commands, and I have no errors so I can run it.
g++ -c -I/usr/local/MATLAB/R2011a/extern/include -I/usr/local/MATLAB/R2011a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/local/MATLAB/R2011a/extern/include/cpp -I/usr/local/MATLAB/R2011a/extern/include -DGLNX86 -DGCC -DMX_COMPAT_32 -O -DNDEBUG "engdemo.cpp"
g++ -O -o "engdemo" engdemo.o -Wl,-rpath-link,/usr/local/MATLAB/R2011a/bin/glnx86 -L/usr/local/MATLAB/R2011a/bin/glnx86 -leng -lmx -lm
But I need to compile in eclipse. Any help?