Compiling C++ software Using Mex
4 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am trying to compile a .cpp code that uses libraries such as opencv 3.0, ceres, boost, and tbb. Below is the output. I have Ubuntu 14.04 and MATLAB 2015a. I have more than one version of opencv (e.g., 2.5, 3.0) in my machine. The one needed for the code is 3.0. So I use the -L to indicate where the path for opencv3.0 libraries are yet the mex command says it can't find them. Anyone know what's going on?
Thanks
mex -v -largeArrayDims GCC='/usr/bin/g++-4.7' SingleEyeFitterCmdLite.cpp -I"/usr/local/include/eigen3/" -I"/home/vradmin/Documents/HARMONIE/singleeyefitter/build/cmd/pupiltracker/include/" -I"/home/vradmin/Documents/HARMONIE/singleeyefitter/lib/" -I"/usr/local/include" -L/home/vradmin/Documents/HARMONIE/opencv/release/lib/ -llibopencv_core -llibopencv_highgui
Warning: Legacy MEX infrastructure is provided for compatibility; it will be removed in a future version of MATLAB. For more information, consult the MEX release notes http://www.mathworks.com/help/matlab/release-notes.html. -> mexopts.sh sourced from directory (DIR = $PREF_DIR) FILE = /home/vradmin/.matlab/R2015a/mexopts.sh ---------------------------------------------------------------- -> MATLAB = /usr/local/MATLAB/R2015a -> CC = gcc-4.7 -> CC flags: CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread CDEBUGFLAGS = -g COPTIMFLAGS = -O -DNDEBUG CLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2015a/bin/glnxa64 -L/usr/local/MATLAB/R2015a/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++ arguments = -> CXX = g++-4.7 -> CXX flags: CXXFLAGS = -ansi -D_GNU_SOURCE -std=gnu++11 -fPIC -fno-omit-frame-pointer -pthread CXXDEBUGFLAGS = -g CXXOPTIMFLAGS = -O -DNDEBUG CXXLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2015a/bin/glnxa64 -L/usr/local/MATLAB/R2015a/bin/glnxa64 -lmx -lmex -lmat -lm arguments = -> FC = gfortran -> FC flags: FFLAGS = -fexceptions -fbackslash -fPIC -fno-omit-frame-pointer FDEBUGFLAGS = -g FOPTIMFLAGS = -O FLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2015a/bin/glnxa64 -L/usr/local/MATLAB/R2015a/bin/glnxa64 -lmx -lmex -lmat -lm arguments = -> LD = g++-4.7 -> Link flags: LDFLAGS = -pthread -shared -Wl,--version-script,/usr/local/MATLAB/R2015a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined LDDEBUGFLAGS = -g LDOPTIMFLAGS = -O LDEXTENSION = .mexa64 arguments = -L/home/vradmin/Documents/HARMONIE/opencv/release/lib/ -llibopencv_core -llibopencv_highgui -> LDCXX = -> Link flags: LDCXXFLAGS = LDCXXDEBUGFLAGS = LDCXXOPTIMFLAGS = LDCXXEXTENSION = arguments = -L/home/vradmin/Documents/HARMONIE/opencv/release/lib/ -llibopencv_core -llibopencv_highgui ----------------------------------------------------------------
-> g++-4.7 -c -I/usr/local/include/eigen3/ -I/home/vradmin/Documents/HARMONIE/singleeyefitter/build/cmd/pupiltracker/include/ -I/home/vradmin/Documents/HARMONIE/singleeyefitter/lib/ -I/usr/local/include -I/usr/local/MATLAB/R2015a/extern/include -I/usr/local/MATLAB/R2015a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -std=gnu++11 -fPIC -fno-omit-frame-pointer -pthread -O -DNDEBUG "SingleEyeFitterCmdLite.cpp"
-> g++-4.7 -O -pthread -shared -Wl,--version-script,/usr/local/MATLAB/R2015a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "SingleEyeFitterCmdLite.mexa64" SingleEyeFitterCmdLite.o -L/home/vradmin/Documents/HARMONIE/opencv/release/lib/ -llibopencv_core -llibopencv_highgui -Wl,-rpath-link,/usr/local/MATLAB/R2015a/bin/glnxa64 -L/usr/local/MATLAB/R2015a/bin/glnxa64 -lmx -lmex -lmat -lm
/usr/bin/ld: cannot find -llibopencv_core /usr/bin/ld: cannot find -llibopencv_highgui collect2: error: ld returned 1 exit status
mex: link of ' "SingleEyeFitterCmdLite.mexa64"' failed.
0 件のコメント
回答 (1 件)
Harsheel
2015 年 7 月 9 日
Replace -llibopencv_core and -llibopencv_highgui to:
-lopencv_core -lopencv_highgui
For -llibname, MATLAB expands libname to liblibname.so
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!