VS2010下編譯安裝DarwinStreamingServer5.5.5
源碼下載鏈接: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);
}
}
}