在网上看到好多朋友编译libjingle(google talk)出现了问题,今天有时间我也来尝试了一下,编译OK了。根据下面的资料
解决了大部分问题,但是有些连接(Linker)的错误并没有解决,
譬如:pathutils文件中的SHGetSpecialFolderPath,helpers文件中的CryptGenRandom、CryptReleaseContext连接错误等等...
具体连接错误如下:
fatal error C1189: #error : You must set the VoiceEngine Lite expiration date in third_party/gips/expiration.h
1>libjingle.lib(pathutils.obj) : error LNK2019: unresolved external symbol __imp__SHGetSpecialFolderPathW@16 referenced in function "bool __cdecl talk_base::GetAppDataFolder(class talk_base::Pathname &,bool,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?GetAppDataFolder@talk_base@@YA_NAAVPathname@1@_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>libjingle.lib(pathutils.obj) : error LNK2019: unresolved external symbol __imp__SHFileOperationW@4 referenced in function "bool __cdecl talk_base::CleanupTemporaryFolder(void)" (?CleanupTemporaryFolder@talk_base@@YA_NXZ)
1>libjingle.lib(helpers1.obj) : error LNK2019: unresolved external symbol __imp__CryptReleaseContext@8 referenced in function "void __cdecl cricket::InitRandom(char const *,unsigned int)" (?InitRandom@cricket@@YAXPBDI@Z)
1>libjingle.lib(helpers1.obj) : error LNK2019: unresolved external symbol __imp__CryptGenRandom@12 referenced in function "void __cdecl cricket::InitRandom(char const *,unsigned int)" (?InitRandom@cricket@@YAXPBDI@Z)
1>libjingle.lib(helpers1.obj) : error LNK2019: unresolved external symbol __imp__CryptAcquireContextW@20 referenced in function "void __cdecl cricket::InitRandom(char const *,unsigned int)" (?InitRandom@cricket@@YAXPBDI@Z)
所以,除了参考下面资料外,还应该添加shell32.lib和advapi32.lib的引用解决之。
(但是一般VC2005 Expres版会出现此问题,VC2008不会有此问题的)
以下是我参考的资料,如下:
最近想在自己的p2p系统中整合进I’M,调研的结果,libjingle各方面都符合要求,准备基于libjingle开发自己的I’M系统,第一步,当然是编译libjingle程序了,但是在网上找了一圈,要么是语焉不详,要么是极其简单,没有办法,只有自己一步步摸索了,同时将步骤整理在blog上,希望后来人少走弯路。
1. 首先下载libjingle的源代码,在如下地址:https://sourceforge.net/projects/libjingle/,我下载的是libjingle-0[1].4.0版本
2. 然后安装Visual C++ 2005 Express Edition,具体下载地址,google一把,非常多的链接。
3. 安装好Visual C++ 2005 Express Edition后,需要安装platform SDK,在如下地址中下载:http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm,按照提示说明安装platform SDK。
4. 在sourceforge.net上下载Expat XML Parser ,地址如下:http://sourceforge.net/project/downloading.php?group_id=10127&use_mirror=nchc&filename=expat_win32bin_2_0_0.exe&33064126,我下载的是2.0.0版本,安装完成后,需要到Visual C++ 2005 Express Edition版本中更新选项,Tools-》Options-》Projects and Solutions-》VC++ directories
Library files: C:/Expat-2.0.0/StaticLibs
Include files: C:/Expat-2.0.0/Source/Lib
Include files: C:/Program Files/Microsoft SDK/include
5. 编译工程,仍旧有以下提示:
------ Build started: Project: libjingle, Configuration: Debug Win32 ------
Compiling...
gipslitemediaengine.cc
d:/p2p/xmpp/libjingle/libjingle-0[1].4.0/libjingle-0.4.0/talk/session/phone/gipslitemediaengine.h(33) : fatal error C1083: Cannot open include file: ''talk/third_party/gips/Interface/GipsVoiceEngineLite.h'': No such file or directory
channelmanager.cc
d:/p2p/xmpp/libjingle/libjingle-0[1].4.0/libjingle-0.4.0/talk/session/phone/gipslitemediaengine.h(33) : fatal error C1083: Cannot open include file: ''talk/third_party/gips/Interface/GipsVoiceEngineLite.h'': No such file or directory
winfirewall.cc
d:/p2p/xmpp/libjingle/libjingle-0[1].4.0/libjingle-0.4.0/talk/base/winfirewall.cc(29) : fatal error C1083: Cannot open include file: ''netfw.h'': No such file or directory
Generating Code...
Build log was saved at "file:///d:/p2p/xmpp/libjingle/libjingle-0[1].4.0/libjingle-0.4.0/talk/Debug/BuildLog.htm"
libjingle - 3 error(s), 0 warning(s)
6. 前面两个编译错误,可以通过下载GipsVoiceEngineLite包完成,但是现在GipsVoiceEngineLite是需要许可才能下载,由于项目中暂时不需要语音功能,所以在项目中去掉了session/phone子项目,前面两个编译错误消失。
7. 在http://www.codeproject.com/KB/winsdk/WinXPSP2Firewall.aspx中下载WinXPSP2Firewall_demo文件包,将icftypes.h和netfw.h拷贝到/talk/base目录下,在base工程中加入icftypes.h文件。
8. 重新编译,libjingle - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========大功告成,libjingle编译成功。
文章出处:http://www.diybl.com/course/3_program/c++/cppsl/200832/102420.html