我想同時鏈接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