我想同时链接32位和64位.so文件在一个c + +程序。 我正在使用64位Ubuntu 12.04.1我也没有重新编译的源文件。链接32位和64位.so文件与g ++为一个c + +程序
当我运行g ++命令:
g++ onlineTraining.cpp -I /usr/local/MATLAB/R2012a_Student/extern/include/ -L /home/forest/SoarSuite/out/ -L /usr/local/MATLAB/R2012a_Student/bin/glnx86/ -I /home/forest/SoarSuite/out/include -leng -lmat -lmex -lut -lSoar
我得到下面的输出,因为它不能识别32位.so文件:
/usr/bin/ld: skipping incompatible /usr/local/MATLAB/R2012a_Student/bin/glnx86//libeng.so when searching for -leng /usr/bin/ld: cannot find -leng /usr/bin/ld: skipping incompatible /usr/local/MATLAB/R2012a_Student/bin/glnx86//libmat.so when searching for -lmat /usr/bin/ld: cannot find -lmat /usr/bin/ld: skipping incompatible /usr/local/MATLAB/R2012a_Student/bin/glnx86//libmex.so when searching for -lmex /usr/bin/ld: cannot find -lmex /usr/bin/ld: skipping incompatible /usr/local/MATLAB/R2012a_Student/bin/glnx86//libut.so when searching for -lut /usr/bin/ld: cannot find -lut collect2: ld returned 1 exit status
当我运行的G ++与命令 - m32:
g++ -m32 onlineTraining.cpp -I /usr/local/MATLAB/R2012a_Student/extern/include/ -L /home/forest/SoarSuite/out/ -L /usr/local/MATLAB/R2012a_Student/bin/glnx86/ -I /home/forest/SoarSuite/out/include -leng -lmat -lmex -lut -lSoar
我得到以下输出,因为现在它不能识别64位.so文件:
/usr/bin/ld: skipping incompatible /home/forest/SoarSuite/out//libSoar.so when searching for -lSoar /usr/bin/ld: cannot find -lSoar /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so when searching for -lstdc++ /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.a when searching for -lstdc++ /usr/bin/ld: cannot find -lstdc++ collect2: ld returned 1 exit status
是否有可能同时链接34位和64位.so文件? 谢谢。
你为什么要这样做? – user93353
@ user93353我正在使用C++程序来连接Matlab和称为SOAR的认知架构。我没有选择在我的电脑上这样做,因为我只有32位的二进制文件和SOAR的64位二进制文件,我没有源文件来重新编译它们。 – user1968703