2014-05-20 49 views
0

我有我的EXE生成的調試文件夾中的Librtmp.dll。頭文件和輔助代碼文件在我的項目中可用,其中包含如下所示。VS2012 LibRTMP包括c到c + +

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

Understanding typedefs for function pointers in C

這導致...

的typedef(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); 
    } 
}; 
+0

首先建議不要總是信任intellisense optput他們只是表明它發生在我身上很多ti我有一些intellisense錯誤警告,但當我開始構建它成功。另外我可以看到,你所包含的RTMP的頭文件是C連接的,所以它是一個C結構,你所做的代碼是C++,因此C連接的結構與C++中的結構不同。這可能是錯誤,但如果您可以提供更多的代碼,這將是一件好事。 – user3494614

+0

@vard Yup。先試了一下。 :) – WebSight

+0

@ user3494614完整的代碼添加。 – WebSight

回答

0

EPIC FACE PALM

最深的歉意

我的類被稱爲RTMP

謝謝@vard