Filter löschen
Filter löschen

mex cc files in ubuntu system

1 Ansicht (letzte 30 Tage)
zhang
zhang am 25 Okt. 2013
Beantwortet: Zack Peters am 25 Okt. 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
  1 Kommentar
Ken Atwell
Ken Atwell am 25 Okt. 2013
What version of MATLAB and Ubuntu?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Zack Peters
Zack Peters am 25 Okt. 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

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by