FFmpeg学习笔记1-C++编程
问题1:64位ffmpeg编译出错,mingw相关头文件缺失,项目位置:E:\cpp\TestFffmpeg
一些整型定义没有找到
问题2: LNK2019问题,extern "C"使用了,lib库也附加了,链接的时候还是报LNK2019的问题
#include <stdio.h> #include <Windows.h> #define __STDC_CONSTANT_MACROS #ifdef __cplusplus extern "C" { #endif #include <libavcodec/avcodec.h> #ifdef __cplusplus } #endif int main() { avcodec_register_all(); //注册常用包 return 0; }
解决方式:
#include <stdio.h> #include <Windows.h> #define __STDC_CONSTANT_MACROS #ifdef __cplusplus extern "C" { #endif #include <libavcodec/avcodec.h> #pragma comment(lib, "avcodec.lib") #ifdef __cplusplus } #endif int main() { avcodec_register_all(); //注册常用包 return 0; }
编译成功。
参考资料:、
#pragma comment:https://www.cnblogs.com/xiehongfeng100/p/4412998.html
MSDN pragma comment:https://docs.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?redirectedfrom=MSDN&view=msvc-160
#ifdef __cplusplus:https://www.cnblogs.com/stonecrazyking/archive/2006/09/23/512552.html
FFmpeg学习: https://juyou.blog.csdn.net/article/details/73992063
雷霄骅博客:https://blog.csdn.net/leixiaohua1020/article/details/47068015