LWHLOVECD 2021-09-02 14:49 采纳率: 0%
浏览 155

ffmpeg中未定义标识符AVCodecParameters,



```c++

#pragma once 
extern  "C" {

#include <libavformat/avformat.h>
#include<libavcodec/avcodec.h>

}

class MMAVStreamPrivate {
public:
    
    
    AVCodecParameters* codecpar=nullptr;//此处报错,未定义标识符AVCodecParameters
};

引用了#include <libavformat/avformat.h> #include<libavcodec/avcodec.h>头文件,而且我在这几个 头文件里面没找 到这个标识符 ,所以有没有人知道这个定义在哪个文件里面,还是版本不对?

  • 写回答

1条回答 默认 最新

  • 刘不刘 2021-09-02 17:41
    关注
    1. 有可能后台没有这个库,或者引用路径错误。
    2. 如果有这个库,那么有可能这个.h文件原来是用C写的。C++中要是用的话要换种方式。
      #define __STDC_CONSTANT_MACROS

    #ifdef _WIN32
    //Windows
    extern "C"
    {
    #include "libavformat/avformat.h"
    };
    #else
    //Linux...
    #ifdef __cplusplus
    extern "C"
    {
    #endif
    #include <libavformat/avformat.h>
    #ifdef __cplusplus
    };
    #endif
    #endif
    请把上述代码将你的#include <libavformat/avformat.h>替换试一试

    评论

报告相同问题?

问题事件

  • 创建了问题 9月2日