【发布时间】:2012-12-05 03:33:50
【问题描述】:
我正在尝试使用 libsndfile。我对 g++ 也不是很好。安装 libsndfile 的方法似乎是使用“make install”。我真的可以,所以我把它编译到了一个目录中。
我在这里尝试编译教程:
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 发行版,我认为你可以在你的系统中安装这些库,然后编译你的程序。
标签: g++ libsndfile