在Ubuntu中,c++调用matlab引擎(
入门实例点这里),已经设置好了库文件的查找路径,但是编译时还是报错:
$ g++ matlab_eigen.cpp -o matlab_eigen -I/opt/MATLAB/R2012a/extern/include -L/opt/MATLAB/R2012a/bin/glnxa64
/tmp/cccXS6eb.o: In function `main':
matlab_eigen.cpp:(.text+0xe): undefined reference to `engOpen'
matlab_eigen.cpp:(.text+0x52): undefined reference to `engEvalString'
matlab_eigen.cpp:(.text+0x63): undefined reference to `engEvalString'
matlab_eigen.cpp:(.text+0x74): undefined reference to `engEvalString'
matlab_eigen.cpp:(.text+0x85): undefined reference to `engEvalString'
collect2: ld returned 1 exit status
$ g++ matlab_eigen.cpp -o matlab_eigen -I/opt/MATLAB/R2012a/extern/include -L/opt/MATLAB/R2012a/bin/glnxa64
/tmp/cccXS6eb.o: In function `main':
matlab_eigen.cpp:(.text+0xe): undefined reference to `engOpen'
matlab_eigen.cpp:(.text+0x52): undefined reference to `engEvalString'
matlab_eigen.cpp:(.text+0x63): undefined reference to `engEvalString'
matlab_eigen.cpp:(.text+0x74): undefined reference to `engEvalString'
matlab_eigen.cpp:(.text+0x85): undefined reference to `engEvalString'
collect2: ld returned 1 exit status