gpt4 book ai didi

c++ - VS2012 LibRTMP包含c到c++

转载 作者:行者123 更新时间:2023-11-30 17:33:27 26 4
gpt4 key购买 nike

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

使用此包含...我可以将 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

IntelliSense:“RTMP *”类型的参数与“RTMP *”类型的参数不兼容

这首先发生在此时。然后再一次,对于每个跟随 r 变量。

r = RTMP_Alloc();

一些阅读建议使用 typedef。

Understanding typedefs for function pointers in C

这导致...

typedef (RTMP*)(RTMP* rtmp);

但是,Visual Studio 只是 mock 我...摇摇头,想知道我是否知道自己在做什么。

IntelliSense:声明与其类同名的成员

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

谢谢。

更新 - 完整代码

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);
}
};

最佳答案

史诗般的手掌

深表歉意

我的类(class)名为 RTMP

谢谢@vard

关于c++ - VS2012 LibRTMP包含c到c++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23755643/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com