我正在尝试配置 eclipse 来编译和运行engdemo.cpp
使用 matlab 引擎的示例。
我按照这里写的说明进行操作,但仍然有错误:
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
当我从 shell 编译程序时,我使用这些命令,并且没有错误,所以我可以运行它。
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
但是我需要在eclipse中编译。有什么帮助吗?