Ubuntu下编译matlab eigen时: undefined reference to `engOpen'

在Ubuntu系统中尝试编译包含MATLAB eigen的项目时,遇到`undefined reference to `engOpen'`错误。问题源于链接阶段未能正确引用libeng.so库。确保在编译命令中使用 `-leng` 而不是 `-llibeng`,因为Linux系统不需要`lib`前缀。同时,要注意MATLAB库在Windows和Linux之间的不兼容性,避免混淆库文件。正确的编译命令应为:`g++ matlab_eigen.cpp -o matlab_eigen -I/opt/MATLAB/R2012a/extern/include -L/opt/MATLAB/R2012a/bin/glnxa64 -leng -lmx`。
摘要由CSDN通过智能技术生成
在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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值