我正在嘗試使用libsndfile。我用g ++也不是很好。安裝libsndfile的方法似乎是使用「make install」。我真的可以這樣做,所以我將它編譯到一個目錄中。如何將libsndfile編譯到項目中?
我試圖編譯這裏的教程:
http://parumi.wordpress.com/2007/12/16/how-to-write-wav-files-in-c-using-libsndfile/
,當我嘗試以下方法:
g++ -Isrc/ test.c
我得到:
/tmp/ccq5fhbT.o: In function SndfileHandle::SndfileHandle(char const*, int, int, int, int)':
test.c:(.text._ZN13SndfileHandleC1EPKciiii[SndfileHandle::SndfileHandle(char const*, int, int, int, int)]+0xf4): undefined reference to sf_open'
/tmp/ccq5fhbT.o: In function SndfileHandle::write(float const*, long)':
test.c:(.text._ZN13SndfileHandle5writeEPKfl[SndfileHandle::write(float const*, long)]+0x27): undefined reference to sf_write_float'
/tmp/ccq5fhbT.o: In function SndfileHandle::SNDFILE_ref::~SNDFILE_ref()':
test.c:(.text._ZN13SndfileHandle11SNDFILE_refD1Ev[SndfileHandle::SNDFILE_ref::~SNDFILE_ref()]+0x20): undefined reference to sf_close'
collect2: ld returned 1 exit status
當我嘗試做以下:
g++ -lsndfile -Isrc/ test.c
我得到
/usr/bin/ld: cannot find -lsndfile
collect2: ld returned 1 exit status
我不知道什麼使我需要給G ++。
編譯提供更多信息你的環境,什麼GNU/Linux發行版,我認爲你可以在你的系統中安裝libs,然後編譯你的程序米 – rendon