现在的位置: 首页 > 综合 > 正文

Visual Studio 6.0编译PWLib1.12总结

2012年05月10日 ⁄ 综合 ⁄ 共 4692字 ⁄ 字号 评论关闭

Visual Studio 6.0编译PWLib总结

1. 我的环境

Visual Studio 6.0

Visual Studio.NET 2010

Microsoft Platform SDK for Windows Server 2003 R2

Microsoft SDKs

Microsoft DirectX 9.0 SDK

MinGW

2. 注意

尝试编译前,请务必阅读 http://www.cnblogs.com/yedaoq/archive/2011/02/22/1960866.html 。本文只涉及部分我在我的编译环境中遇到的,并且官方编译说明中没有包含的问题。

3. 项目变动、编译顺序

在官方文档中,提到的编译顺序为:ConsoleConsole ComponentsPWLib。但在目前最新版本(1.12)的PWLib中,已经不再包含Console Components项目。官方解释是为了简化Windows下库文件的管理,并与Unix保持一致。Console Components的所有源文件都添加到Console工程中了。

 

据我观察,installdir\PWLib\src\ptclib中的文件应该就是原Console Components工程的内容,而installdir\PWLib\src\ptlib则是原Console工程的内容。理由是:根据官方文档,Console Components是一个包含额外的PWLib特性的工程,这些特性依赖于特定的其它库和SDK。由于我的机器上存在Platform SDKDirectX SDK,这些SDK包含了对Direct Sound、IPv6等的支持,在Console的编译过程中,需要手动将installdir\PWLib\src\ptclib中的部分文件添加到Console工程中。这部分文件的功能在我看来符合“特性”的定义。因而我推测原Console Components的文件被放置在installdir\PWLib\src\ptclib目录中。当然,这只是猜测而已。

 

新版本的PWLib的编译顺序为ConsoleMergeSymPWLibMergeSym是一个新工程。官方FAQ中有关于此工程的一些陈述:PWLib和OpenH323试图在各个版本间保持DLL入口点的序号的一致性,MergeSym程序会比较DLL中的函数签名与.dtf文件中列出的入口点,并确保最终的文件以兼容的序号结束。

3. IncludeLib目录顺序

PWLib包含对_CrtReportBlockType的调用,其所在头文件为crtdbg.h。但是VC6带的crtdbg.h不包含该函数,而Platform SDK带的crtdbg.h中包含。因而platform SDK目录应在VC6目录之前。

另外,PWLib自带了WinceWM平台的一些头文件。在之前的编译过程中,这些头文件有影响。因此,建议将PWLib目录置于Include目录的偏后位置。另外,我觉得也可尝试移除这些头文件,它们在installdir\PWLib\include\ptlib\wince和installdir\PWLib\include\ptlib\wm中。

4. Console编译问题

错误内容:

Microsoft Platform SDK for Windows Server 2003 R2 \sdk\include\wspiapi.h(47) : error C2265: '' : reference to a zero-sized array is illegal

解决办法:

wspiapi.h头文件头部添加语句:#define _WSPIAPI_COUNTOF

 

错误内容:

fatal error C1083: Cannot open source file: '.\podbc.cxx': No such file or directory

解决办法:

该文件位置不对,实际位置在installdir\PWLib\src\ptclib

 

错误内容:

G:\Open Source\ptlib\src\ptlib\common\videoio.cxx(567) : error C2059: syntax error : '}' G:\Open Source\ptlib\src\ptlib\common\videoio.cxx(568) : error C2143: syntax error : missing ';' before '}' 

解决办法:

sizeTable表的最后一个子结构中没有定义内容(即使用成员默认值)。但在VC上无法编译通过,其写法应改为:{ NULL, 0, 0 }

5. MergeSym编译问题

MergeSym编译过程中,一般会出现链接问题。有两个解决方向:

 

首先,删除.dtf文件。之前说过,MergeSym会用.dtf文件来保持DLL入口序号的兼容性。默认的dtf文件包含启用了所有特性时的入口点列表,即最全的列表。如果实际上没有启用某些特性,则MergeSym的对比过程会失败。官方建议删除所有的.dtf文件。这些文件在installdir\PWLib\include\ptlib\msos中。

 

其次,当启用了某些特性时,需要手动向Console工程中添加额外的文件,否则会在编译MergeSym时出链接错误。Console编译过程中,configure程序会扫描所有硬盘驱动器,查找其中的程序库,基于此确定启用哪些特性。以下为安装了platform SDKVC6时的特性加载情况:

 

Located DNS Resolver at f:\program files\microsoft platform sdk for windows server 2003 r2\

Located IPv6 Support at f:\program files\microsoft platform sdk for windows server 2003 r2\include\

Located QoS Support at f:\program files\microsoft platform sdk for windows server 2003 r2\include\

Located ODBC support at f:\program files\microsoft platform sdk for windows server 2003 r2\include\

Located Direct Sound Support at f:\program files\microsoft visual studio\vc98\

Features:

                          Version enabled

                       Byte Order enabled

                Semaphore Support enabled

                   Plugin Support enabled

                     DNS Resolver enabled

                       Cyrus SASL DISABLED

                        Open LDAP DISABLED due to absence of feature sasl

                         Open SSL DISABLED

                     Open SSL AES DISABLED due to absence of feature openssl

                 Windows Open SSL DISABLED

             Windows Open SSL AES DISABLED due to absence of feature winssl

                        Expat XML DISABLED

                Windows Expat XML DISABLED

                             VXML DISABLED due to absence of feature expat|winexpat

                           Jabber DISABLED due to absence of feature expat|winexpat

                           XMLRPC DISABLED due to absence of feature expat|winexpat

                             SOAP DISABLED due to absence of feature expat|winexpat

                       Speech API DISABLED

                     IPv6 Support enabled

                      QoS Support enabled

         Simple DirectMedia Layer DISABLED

                    Video Support enabled

                      ASN Support enabled

                     STUN Support enabled

             pipe channel Support enabled

   DTMF encoding/decoding support enabled

                 WAV file support enabled

           SOCKS protocol support enabled

             FTP protocol support enabled

            SNMP protocol support enabled

          Telnet protocol support enabled

        remote connection support enabled

                   Serial Support enabled

                POP3/SMTP Support enabled

                     HTTP Support enabled

             HTTP service Support enabled

     Config file protocol support enabled

       Socket aggregation support enabled

               Video file support enabled

                    Sound support enabled

             Direct Sound Support enabled

                     ODBC support enabled

 

若启用了这些特性,则需要向Console工程添加至少下列文件:installdir\PWLib\src\ptclib目录中的delaychan.cxx、http.cxx、pvfiledev.cxx、pvidfile.cxx、pwavfile.cxx、pwavfiledev.cxx,以及installdir\PWLib\src\ptlib\common中的pglobalstatic.cxx。

若要阻止Configure扫描某些位置以免启用某些特性,可以编辑环境变量:MSVC_PWLIB_CONFIGURE_EXCLUDE_DIRSPWLIB_CONFIGURE_EXCLUDE_DIRS等。

 

6. PWLib编译问题

错误内容:

Microsoft Visual Studio\VC98\INCLUDE\d3dtypes.h(14) : fatal error C1083: Cannot open include file: 'subwtype.h': No such file or directory

解决办法:

添加WIN32宏的定义,可添加到dllmain.cxx中。如:#define WIN32 1

 

错误内容:

LINK : fatal error LNK1181: cannot open input file "ptclib.lib"

解决办法:

之前提到Console Components项目合并到Console中了,因而PWLib项目也不再需要依赖ptclib.lib(Console Components的输出)。打开PWLib项目属性框->Link->Object/Library Modules,将其中的ptclib.lib去掉即可。

 

错误内容:

fatal error LNK1202: "ptlib.pdb" is missing debugging information for referencing module

解决办法:

将installdir\PWLib\Lib文件夹删除,所有工程重新编译。

 

 

抱歉!评论已关闭.