VS2012 LibRTMP include c into c++

VS2012 LibRTMP include c into c++

本文关键字:into c++ include LibRTMP VS2012      更新时间:2023-10-16

我在生成我的exe的调试文件夹中有Librtmp.dll。头文件和辅助代码文件在我的项目中可用,包括如下所示。

使用这个包括....我可以使用智能感知的librtmp

extern "C" {
    #include "libavcodec/avcodec.h"
    #include "libavdevice/avdevice.h"
    #include "libavfilter/avfilter.h"
    #include "libavformat/avformat.h"
    #include "libavutil/avutil.h"
    #include "librtmp/rtmp.h"
}

下面是正在使用的代码示例。

RTMP *r;
char uri[]="rtmp://localhost:1935/live/desktop";
r = RTMP_Alloc();
RTMP_Init(r);
RTMP_SetupURL(r, (char*)uri);
RTMP_EnableWrite(r);
RTMP_Connect(r, NULL);
RTMP_ConnectStream(r,0);

VS2012

智能感知:类型为"RTMP *"的参数与类型为"RTMP *"的参数不兼容

这首先发生在这一点。然后再一次,对于后面的每个r变量

r = RTMP_Alloc();

有人建议使用typedef。

理解C语言中函数指针的类型

这导致…

typepedef (RTMP*)(RTMP* RTMP);

然而,Visual Studio只是嘲笑我…摇着它的头,想知道我是否知道自己在做什么。

智能感知:声明与其类同名的成员

任何线索或想法都会有用的。

谢谢。

更新-完整代码

extern "C" {
    #include "libavcodec/avcodec.h"
    #include "libavdevice/avdevice.h"
    #include "libavfilter/avfilter.h"
    #include "libavformat/avformat.h"
    #include "libavutil/avutil.h"
}
#include "librtmp/rtmp.h"
class RTMP
{
    RTMP()
    {
    }
    ~RTMP()
    {
    }
    typedef (RTMP*)(RTMP* rtmp);
    void RTMP::Run()
    {
            //Code
        //Init RTMP code
        RTMP *r;
        char uri[]="rtmp://localhost:1935/live/desktop";
        r = RTMP_Alloc();
        RTMP_Init(r);
        RTMP_SetupURL(r, (char*)uri);
        RTMP_EnableWrite(r);
        RTMP_Connect(r, NULL);
        RTMP_ConnectStream(r,0);
    }
};

EPIC FACE PALM

最深的歉意我的类叫做RTMP

谢谢@vard