mex cc files in ubuntu system

3 views (last 30 days)
zhang
zhang on 25 Oct 2013
Answered: Zack Peters on 25 Oct 2013
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

Answers (1)

Zack Peters
Zack Peters on 25 Oct 2013
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

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!