C++ VS2012 LibRTMP将c包含到c++;
我在生成exe的调试文件夹中有Librtmp.dll。标题和辅助代码文件在我的项目中可用,包括如下所示 使用此选项包括。。。。我可以将librtmp与intellisense一起使用C++ VS2012 LibRTMP将c包含到c++;,c++,c,visual-studio-2012,C++,C,Visual Studio 2012,我在生成exe的调试文件夹中有Librtmp.dll。标题和辅助代码文件在我的项目中可用,包括如下所示 使用此选项包括。。。。我可以将librtmp与intellisense一起使用 extern "C" { #include "libavcodec/avcodec.h" #include "libavdevice/avdevice.h" #include "libavfilter/avfilter.h" #include "libavformat/avforma
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*”的参数不兼容
这首先发生在这一点上。再一次,对于每个follow r变量
r = RTMP_Alloc();
一些阅读材料建议使用typedef
这导致
类型定义(RTMP*)(RTMP*RTMP)
然而,Visual Studio只是嘲笑我。。。摇摇头,想知道我是否知道自己在做什么
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);
}
};
史诗脸谱
深表歉意
我的班级叫RTMP
谢谢@vard第一个建议不要总是相信intellisense Optp,但它们只是表明我经常遇到一些intellisense错误警告,但当我开始构建时,它就成功了。我也看到,你所包含的RTMP的头是C++连接,所以它是C++结构,代码是C++,所以C连接的结构不同于C++中的结构。这可能是错误,但如果您能提供更多关于代码的信息,那就太好了。@vard-Yup。先试试看。:)@已添加user3494614完整代码。此处存在名称冲突,显然RTMP是库提供的某些数据结构的名称,并且您的类具有相同的名称。重命名类以解决此问题
RTMP*r
类中的此代码将r
声明为指向类的指针,而不是库结构。