我尝试使用http://yaafe.sourceforge.net/manual/install.html中的yaafe库。一切都安装好,并在python中正常工作。但是我想使用matlab接口,我尝试使用以下命令编译yaafemex.cpp:
mex -v -L/usr/local/yaafe-v0.64/lib -I/usr/local/yaafe-v0.64/include/yaafe-core yaafemex.cpp
它会出现以下错误。有人能给我一些启示吗?
-> mexopts.sh sourced from directory (DIR = $MATLAB/bin)
FILE = /home/eric/R2010A/bin/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /home/eric/R2010A
-> CC = gcc
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fPIC -pthread -m32 -fexceptions -D_FILE_OFFSET_BITS=64
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/home/eric/R2010A/bin/glnx86 -L/home/eric/R2010A/bin/glnx86 -lmx -lmex -lmat -lm -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/home/eric/R2010A/bin/glnx86 -L/home/eric/R2010A/bin/glnx86 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> FC = g95
-> FC flags:
FFLAGS = -fexceptions -fPIC
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/home/eric/R2010A/bin/glnx86 -L/home/eric/R2010A/bin/glnx86 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = g++
-> Link flags:
LDFLAGS = -pthread -shared -m32 -Wl,--version-script,/home/eric/R2010A/extern/lib/glnx86/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexglx
arguments = -L/usr/local/yaafe-v0.64/lib
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments = -L/usr/local/yaafe-v0.64/lib
----------------------------------------------------------------
Warning: You are using gcc version "4.4.3-4ubuntu5.1)". The version
currently supported with MEX is "4.2.3".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
-> g++ -c -I/usr/local/yaafe-v0.64/include/yaafe-core -I/home/eric/R2010A/extern/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -pthread -DMX_COMPAT_32 -O -DNDEBUG "yaafemex.cpp"
-> g++ -O -pthread -shared -m32 -Wl,--version-script,/home/eric/R2010A/extern/lib/glnx86/mexFunction.map -Wl,--no-undefined -o "yaafemex.mexglx" yaafemex.o -L/usr/local/yaafe-v0.64/lib -Wl,-rpath-link,/home/eric/R2010A/bin/glnx86 -L/home/eric/R2010A/bin/glnx86 -lmx -lmex -lmat -lm
yaafemex.o: In function `readFeature(mxArray_tag*, YAAFE::Engine*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
yaafemex.cpp:(.text+0x15f): undefined reference to `YAAFE::Engine::getOutput(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
yaafemex.cpp:(.text+0x2c9): undefined reference to `YAAFE::InputBuffer::availableTokens()'
yaafemex.cpp:(.text+0x305): undefined reference to `YAAFE::InputBuffer::availableTokens()'
yaafemex.cpp:(.text+0x318): undefined reference to `YAAFE::InputBuffer::read(double*, int)'
yaafemex.cpp:(.text+0x320): undefined reference to `YAAFE::InputBuffer::availableTokens()'
yaafemex.cpp:(.text+0x32c): undefined reference to `YAAFE::InputBuffer::consumeTokens(int)'
yaafemex.o: In function `processBuffer(mxArray_tag*, YAAFE::Engine*, double*, int)':
yaafemex.cpp:(.text+0x45b): undefined reference to `YAAFE::Engine::reset()'
yaafemex.cpp:(.text+0x489): undefined reference to `YAAFE::Engine::getInput(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
yaafemex.cpp:(.text+0x51e): undefined reference to `YAAFE::DataBlock::preferedBlockSize()'
yaafemex.cpp:(.text+0x545): undefined reference to `YAAFE::OutputBuffer::write(double*, int)'
yaafemex.cpp:(.text+0x552): undefined reference to `YAAFE::Engine::process()'
yaafemex.cpp:(.text+0x562): undefined reference to `YAAFE::Engine::flush()'
yaafemex.cpp:(.text+0x574): undefined reference to `YAAFE::Engine::getOutputs()'
yaafemex.o: In function `processFile(mxArray_tag*, YAAFE::Engine*, char*)':
yaafemex.cpp:(.text+0x668): undefined reference to `YAAFE::AudioFileProcessor::AudioFileProcessor()'
yaafemex.cpp:(.text+0x697): undefined reference to `YAAFE::AudioFileProcessor::processFile(YAAFE::Engine&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
yaafemex.cpp:(.text+0x714): undefined reference to `YAAFE::Engine::getOutputs()'
yaafemex.cpp:(.text+0x7fb): undefined reference to `YAAFE::AudioFileProcessor::~AudioFileProcessor()'
yaafemex.cpp:(.text+0x80e): undefined reference to `YAAFE::AudioFileProcessor::~AudioFileProcessor()'
yaafemex.o: In function `mexFunction':
yaafemex.cpp:(.text+0x960): undefined reference to `YAAFE::ComponentFactory::instance()'
yaafemex.cpp:(.text+0x96f): undefined reference to `YAAFE::ComponentFactory::loadLibrary(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
yaafemex.cpp:(.text+0xb28): undefined reference to `YAAFE::DataFlow::load(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
yaafemex.cpp:(.text+0xc2c): undefined reference to `YAAFE::Engine::Engine()'
yaafemex.cpp:(.text+0xc5e): undefined reference to `YAAFE::Engine::load(YAAFE::DataFlow const&)'
collect2: ld returned 1 exit status
mex: link of ' "yaafemex.mexglx"' failed.
答案 0 :(得分:2)
您需要告诉mex库的名称。它应该像
mex -v -L/usr/local/yaafe-v0.64/lib -I/usr/local/yaafe-v0.64/include/yaafe-core -l"YOUR_LIB_NAME_HERE" yaafemex.cpp
其中“YOUR_LIB_NAME_HERE”是相应库的名称。 (没有引号)