命令无法在c ++

时间:2017-10-27 21:52:34

标签: c++ ubuntu makefile g++ linker-errors

我想使用.wav格式开发代码,因此我需要libsndfile1。我使用sudo apt-get install libsndfile1-dev安装了这个,我在程序中包含了header。我试图用这个命令编译它:g++ -g -Wall -std=c++17 -lsndfile(...)。你知道为什么我不能编译吗?

g++ -g -Wall -std=c++17 -lsndfile  -o AudioEntropy obj/main.o obj/AudioEntropy.o
obj/AudioEntropy.o: In function `SndfileHandle::SNDFILE_ref::~SNDFILE_ref()':

/usr/local/include/sndfile.hh:163: undefined reference to `sf_close'
obj/AudioEntropy.o: In function `SndfileHandle::SndfileHandle(char const*, int, int, int, int)':

/usr/local/include/sndfile.hh:181: undefined reference to `sf_open'
obj/AudioEntropy.o: In function `SndfileHandle::read(short*, long)':

/usr/local/include/sndfile.hh:332: undefined reference to `sf_read_short'
obj/AudioEntropy.o: In function `SndfileHandle::write(short const*, long)':

/usr/local/include/sndfile.hh:348: undefined reference to `sf_write_short'
collect2: error: ld returned 1 exit status

Makefile:22: recipe for target 'AudioEntropy' failed

make: *** [AudioEntropy] Error 1

0 个答案:

没有答案