[英]how compile .c file when using vorbis library. undefined reference to vorbis_info_init
I installed libvorbis-div with sudo apt install libvorbis-dev
.我用
sudo apt install libvorbis-dev
安装了 libvorbis-div 。 But when i tried to compile my simple code with gcc ac
command, i get "undefined reference to `vorbis_info_init'" error.但是,当我尝试使用
gcc ac
命令编译我的简单代码时,出现“对 `vorbis_info_init' 的未定义引用”错误。
ac交流电
#include "vorbis/codec.h"
int main(int argc, char **argv){
vorbis_info vi;
vorbis_info_init(&vi);
return(0);
}
If you are only running gcc ac, then you are missing the linker arguments.如果您只运行 gcc ac,那么您将缺少链接器参数。 You should introduce the library you are using to the compiler/linker, which in this case is gcc.
您应该将您正在使用的库引入编译器/链接器,在本例中为 gcc。
PS Probably just add -lvorbis, but don't just copy-paste, parse these flags in your brain! PS 可能只是添加-lvorbis,但不要只是复制粘贴,在你的大脑中解析这些标志!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.