VS2010下編譯安裝DarwinStreamingServer5.5.5

來源:互聯網
上載者:User

標籤:des   http   使用   os   檔案   io   

源碼下載連結:http://dss.macosforge.org/
源碼版本: 5.5.5版本
電腦環境:visual studio2010,window 7 x64系統。
用VS2010開啟WinNTSupport檔案夾下的.dsw工程,全部轉換vs2010。
 
使用vs2010編譯的遇到一些問題和解決方案:
(1)          提示:winsock2某些函數重定義。
方法:DarwinStreamingSrvr6.0.3-Source\CommonUtilitiesLib\OSHeaders.h(209)的#include<windows.h> 前面加上:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
 
(2)          提示:error C2039: ‘timeGetTime‘ : is not a member of ‘`global namespace‘‘
 方法:包含標頭檔Mmsystem.h,並在工程設定中引入該Winmm.lib庫就OK了。
注意:加在其他標頭檔前面,並且形式如下,三行都要加上:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <Mmsystem.h>
 
(3)          提示:error C1083: 無法開啟包括檔案:“grp.h”: No such file or directory
方法:將#include <grp.h>
#include <membership.h>
#include <pwd.h>
#include <unistd.h>
這個幾個都注釋掉,然後就會發現有兩個函數會出錯,好,那就暫時將這兩個函數注釋掉先。後來我編譯中尋找了下,好像貌似在編譯過程中,所有項目中,沒有那個調用了這兩個函數。所有注釋就沒關係了。
 
(4)          無法開啟包括檔案:“arpa/inet.h”: No such file or directory
方法:注釋掉就可以了或者用下面的語句來代替
#defineWIN32_LEAN_AND_MEAN
#include<windows.h>
#pragmacomment(lib, "wsock32.lib")
參考資料:
?url=0ZJZZTYyfhUIpS1Vd-jMZHP6gbMRwyG5iYlUzAH_uHQTemUtopRbKK_-FfAA0O2knaP7sgs8bfkzofTB5KldAK
(5)          error C2039: “strlcpy”: 不是“`globalnamespace‘”的成員
方法:strlcpy不是windows的函數,將strlcpy該為對應的函數strncpy
參考資料:
(6)          error C3861: “SetTempPath”: 找不到標識符
方法:搜尋下SetTempPath,其實這個函數是有的,只是被注釋掉了,哎.....去掉注釋就可以了。
(7)          error PRJ0002 : 錯誤的結果 2 (從“C:\ProgramFiles (x86)\Microsoft Visual Studio 9.0\VC\bin\cl.exe”返回)
方法:在d:/ProgramFiles/Microsoft Visual Studio 9.0/VC/bin直接點擊cl.exe,然後發現少了哪個庫,直接下載就好了。
一般是缺少mspdb80.dll ,所以不用下載。在\Common7\IDE中能找到。mspdbsrv.exe 或 mspdbcore.dll 丟失或者其版本和 mspdb80.dll 的版本不同,確定這三個檔案的相同版本安裝在系統裡。
在VC安裝目錄下的\Common7\IDE 目錄下拷貝這三個檔案到安裝目錄下的VC\bin下即可
參考資料:
(8)          cl: 命令列 errorD8004 :“/I”需要參數
解決方案:在工程屬性->C/C++選項->附加命令中有/I ,應該是指這個沒有參數.工程是從VC6的工程轉過來的,直接去掉就可以編譯。
(9)          xxx標頭檔找不到
解決方案:標頭檔目錄中添加該目錄的包含就ok了。
(10)      最後就是無法解析的外部符號,這個就好辦了,找到該函數在那個cpp裡面,或者是哪個項目的lib中,添加進來編譯就行了。
(11)      error C3861: “snprintf”: 找不到標識符
方法:snprintf也不是windows的函數,將snprintf改為對用的_snprintf就可以了
(12)      RTPStream::UDPMonitorWrite函數出錯:
方法:將那幾個出錯的類型,改為對應的類型就好了。
修改RTPStream::UDPMonitorWrite方法為:
void RTPStream::UDPMonitorWrite(void*thePacketData, UInt32 inLen,  Bool16isRTCP)
{
   if (FALSE == fUDPMonitorEnabled || 0 == fMonitorSocket || NULL ==thePacketData)
       return;
       
   if ((0 != fPlayerToMonitorAddr) && (this->fRemoteAddr !=fPlayerToMonitorAddr))
       return;
       
  UInt16 RTCPportOffset = (TRUE == isRTCP)? 1 : 0;
 
 
   struct sockaddr_in sin;
   memset(&sin, 0, sizeof(struct sockaddr_in));
   sin.sin_family = AF_INET;
   sin.sin_addr.s_addr = htonl(fMonitorAddr);
   
   if (fPayloadType == qtssVideoPayloadType)
       sin.sin_port = (USHORT) htons(fMonitorVideoDestPort+RTCPportOffset);
   else if (fPayloadType == qtssAudioPayloadType)
       sin.sin_port = (USHORT) htons(fMonitorAudioDestPort+RTCPportOffset);
   
   if (sin.sin_port != 0)
    {
       int result = ::sendto(fMonitorSocket,(char*) thePacketData, inLen, 0,(struct sockaddr *)&sin, sizeof(struct sockaddr));
      if (DEBUG)
       {   if (result < 0)
                qtss_printf("RTCP MonitorSocket sendto failed\n");
           else if (0)
qtss_printf("RTCP MonitorSocket sendto port=%hu, packetLen=%"_U32BITARG_"\n",ntohs(sin.sin_port), inLen);
       }
    }
}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.