mex cc files in ubuntu system

조회 수: 2 (최근 30일)
zhang
zhang 2013년 10월 25일
답변: Zack Peters 2013년 10월 25일
I've download some code online. The makefile is like following:
all: cascade fconv_var_dim
cascade: cascade.cc model.cc model.h
mex -O -o cascade \
CXXOPTIMFLAGS="-O3 -DNDEBUG -fomit-frame-pointer" \
LDOPTIMFLAGS="-O3" \
CXXFLAGS="\$$CXXFLAGS -Wall" \
LDFLAGS="\$$LDFLAGS -Wall" \
cascade.cc model.cc
fconv_var_dim: fconv_var_dim.cc
mex -O -o fconv_var_dim \
CXXOPTIMFLAGS="-O3 -DNDEBUG -fomit-frame-pointer" \
LDOPTIMFLAGS="-O3" \
CXXFLAGS="\$$CXXFLAGS -Wall" \
LDFLAGS="\$$LDFLAGS -Wall" \
fconv_var_dim.cc
clean:
rm *.mex*
I use command !make to run in Matlab. But it gives me the following error:
mex -O -o cascade \
CXXOPTIMFLAGS="-O3 -DNDEBUG -fomit-frame-pointer" \
LDOPTIMFLAGS="-O3" \
CXXFLAGS="\$CXXFLAGS -Wall" \
LDFLAGS="\$LDFLAGS -Wall" \
cascade.cc model.cc
mex: unrecognized option '-O'
mex: option '-o' is ambiguous; possibilities: '--output-comment' '--output-directory' '--output-format'
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
! I can't find file `cascade'.
<*> cascade
CXXOPTIMFLAGS=-O3 -DNDEBUG -fomit-frame-pointer LDOPTIMFLAGS=-O3...
(Press Enter to retry, or Control-D to exit)
Please type another input file name:
Thanks
  댓글 수: 1
Ken Atwell
Ken Atwell 2013년 10월 25일
What version of MATLAB and Ubuntu?

댓글을 달려면 로그인하십시오.

답변 (1개)

Zack Peters
Zack Peters 2013년 10월 25일
Hi Zhang,
Regarding the "I can't find file 'cascade'." error, the filename is 'cascade.cc' not 'cascade'. Try adding '.cc' extension to the MEX command and try MEXing again.
With regards to the -O and -o messages, I believe that they are used to turn on compiler optimizations which are already on by default. You may want to try removing both options to remove the other messages.
If it is not a case of adding the extension, perhaps it is due to the cascade.cc not being in ether the current directory or on the system path? would you try putting the cascade.cc in the same directory as the makefile that you are using?
~Zack

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by