首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未找到avcodec符号

未找到avcodec符号
EN

Stack Overflow用户
提问于 2013-02-26 01:23:17
回答 1查看 929关注 0票数 1

我正在尝试在FFMPEG库中构建示例代码,我在项目中添加了libavcode.h和libavcode.a,并将头搜索usr/local/include和库搜索设置为usr/local/lib

当我编译这个例子时,我得到了这个错误... (所有这些错误都与avcodec库有关)

{

代码语言:javascript
复制
Undefined symbols:
 "avcodec_find_encoder(CodecID)", referenced from:
  video_encode_example(char const*, CodecID)in main.o
  "avcodec_open2(AVCodecContext*, AVCodec*, AVDictionary**)", referenced from:
  video_encode_example(char const*, CodecID)in main.o
  video_decode_example(char const*, char const*)in main.o
  "av_init_packet(AVPacket*)", referenced from:
  video_decode_example(char const*, char const*)in main.o
  "av_free(void*)", referenced from:
  video_encode_example(char const*, CodecID)in main.o
  video_encode_example(char const*, CodecID)in main.o
  video_encode_example(char const*, CodecID)in main.o
  video_decode_example(char const*, char const*)in main.o
  video_decode_example(char const*, char const*)in main.o
  "avcodec_alloc_context3(AVCodec*)", referenced from:
  video_encode_example(char const*, CodecID)in main.o
  video_decode_example(char const*, char const*)in main.o
  "av_opt_set(void*, char const*, char const*, int)", referenced from:
  video_encode_example(char const*, CodecID)in main.o
  "av_image_alloc(unsigned char**, int*, int, int, PixelFormat, int)", referenced from:
  video_encode_example(char const*, CodecID)in main.o
  "avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)", referenced from:
  video_encode_example(char const*, CodecID)in main.o
  video_encode_example(char const*, CodecID)in main.o
  "avcodec_register_all()", referenced from:
  _main in main.o
  "avcodec_find_decoder(CodecID)", referenced from:
  video_decode_example(char const*, char const*)in main.o
  "avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, AVPacket const*)", referenced from:
  video_decode_example(char const*, char const*)in main.o
  video_decode_example(char const*, char const*)in main.o
  "avcodec_close(AVCodecContext*)", referenced from:
  video_encode_example(char const*, CodecID)in main.o
  video_decode_example(char const*, char const*)in main.o
  "avcodec_alloc_frame()", referenced from:
  video_encode_example(char const*, CodecID)in main.o
  video_decode_example(char const*, char const*)in main.o
 ld: symbol(s) not found
 collect2: ld returned 1 exit status

}你知道我为什么会有这个问题吗?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-13 11:20:38

解决方案是将此代码添加到标题中,因为我猜FFMPEG是用C编写的

代码语言:javascript
复制
extern "C"
{
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include "avassert.h"
#include "avutil.h"
#include "intreadwrite.h"
#include "mem.h"
 }
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15072677

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档