博客园  :: 首页  :: 联系 :: 管理

在Windows VS.NET 2003 下编译 PWLib 总结

Posted on 2005-11-18 14:08  sunrack  阅读(2608)  评论(17编辑  收藏  举报

版本:

PWLib-Mimas Patch2-(v1.8.7)

需要的包文件:

db-4.1.25

cyrus-sasl-2.1.21

expat-1.95.2

openldap-2.1.17

openssl-0.9.7e

SDL-1.2.9

编译步骤:

1、安装 GNU bison  :解压缩后,只需要 Tools文件夹,注意路径一定为C:\Tools。同时,在VS.Net 2003  “工具”——“选项”——“项目”——“VC++目录”——“可执行文件中添加 “C:\Tools”

2、安装需要的包,包括:

db-4.1.25

cyrus-sasl-2.1.21

expat-1.95.2

openldap-2.1.17

openssl-0.9.7e

SDL-1.2.9

可以放在一个目录中,如 Package\ ,包文件最好放在C盘中,且目录的英文字母尽量靠前,这样编译时就能很快找到这些包。


安装指南:

(1)  db-4.1.25

    使用VC 6.0 或 VS.NET 2003 打开,直接编译 db-4.1.25\build_win32\Berkeley_DB.dsw ,重新生成解决方案即可,生成四个版本,需要的可能只有一个:Release_static。

(2)  cyrus-sasl-2.1.21

    使用 VS.NET 2003 的命令行编译,菜单位置 \「开始」菜单\程序\开发\Microsoft Visual Studio .NET 2003\Visual Studio .NET 工具\Visual Studio .NET 2003 命令提示

    输入命令:

      ->  cd D:\cyrus-sasl-2.1.21
      ->  nmake /f NTMakefile  DB_INCLUDE=D:\db-4.1.25\build_win32   DB_LIBPATH=D:\db-4.1.25\build_win32\Release_static

    执行到最后,会有很多错误(默认库冲突),不用理会。我们需要的库已经在cyrus-sasl-2.1.21\lib\libsasl.lib中了,

(3)openldap-2.1.17
    
    首先解压缩 openldap-2.1.17-win32.zip, 将其中的文件拷贝到openldap-2.1.17\,进行覆盖。

    使用VC 6.0打开openldap-2.1.17\include\setup.dsp,重新生成项目,将会生成包含文件。

    使用VC 6.0打开 openldap-2.1.17\build\main.dsw,添加库文件路径:cyrus-sasl-2.1.21\lib 和 包含文件路径:cyrus-sasl-2.1.21\include。
    
    选择菜单 Build -> Batch Build
,选择 dll- Win32 DLL Debug 和 dll - Win32 DLL Release两项,然后Build即可。生成的文件位于openldap-2.1.17\DLLDebug 和 openldap-2.1.17\DLLRelease 目录下。

(4)expat-1.95.2

    使用 VS.NET 2003 打开expat_1.95.2\expat.sln 或(expat.dsw),然后重新生成解决方案,需要的文件生成到 expat_1.95.2\Release 和 expat_1.95.2\Debug 目录下。

(5)openssl-0.9.7e

    将文件夹 openssl-0.9.7e\out32  改名为 openssl-0.9.7e\out32.dbg 即可,这是Debug版本,另外Release版本在 openssl-0.9.7e\out32dll 下。

(6)SDL-1.2.9

    只需解压即可。

3
、解压缩PWLib-Mimas Patch2-(v1.8.7)到目录 PWLib\

   
VS.Net 2003 中添加相应的路径

        installdir\PWLIB\INCLUDE    加入到 “包含文件

        installdir\PWLIB\LIB               加入到可执行文件

        installdir\PWLIB\LIB               加入到 库文件

4 VS.Net 2003 打开pwlib.sln

5、在Debug方式下,分别重新编译项目 “console”  “console component” 

6、在Release方式下,分别重新编译项目 “console” “console component” “PTLib”

7
、在Debug方式下,重新编译项目 “PTLib”  

注意:

    不能直接在Debug方式下重新编译“PTLib”,因为其要生成 ptlibd.lib &
ptlibd.dll,
ptlibd.dll依赖于“console” “console component”Release方式下生成的lib文件。


8
、生成的库文件列表:

        Regardless of the environment you are using, there are three different projects that can be built as either Debug or Release versions: 

Name

Description

Debug version

Release version

Console

basic PWLib library as a static library

ptlibsd.lib

ptlibs.lib

PTLib

basic PWLib library as a DLL

ptlibd.lib &
ptlibd.dll

ptlib.lib &
ptlib.dll

Console Components

contains additional PWLib features. 
Only available as a static library

ptclibd.lib

ptclib.lib

        The static libraries can be built independently, but building the DLLs requires building the "MERGESYM" utility first which depends on the Release version of the libraries.

9、在VS.Net 2003中调试时显示PWLib变量的值

    找到“C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\Debugger\autoexp.dat”

    在最后添加:    

; for PTLib
PObject =<,t>
PString =<theArray,s>
PCharArray =<theArray,s>
PContainer=<,t> size=<reference->size> ref=<reference->count>
PAbstractArray =<,t> size=<reference->size> ref=<reference->count>
PArrayObjects =<,t> size=<theArray->reference->size> ref=<reference->count>
PIPSocket::Address = <v.four.S_un.S_un_b.s_b1,u>.<v.four.S_un.S_un_b.s_b2,u>.<v.four.S_un.S_un_b.s_b3,u>.<v.four.S_un.S_un_b.s_b4,u>
PTimeInterval = <milliseconds>
PTime = <theTime>

; This section lets you define your own errors for the HRESULT display.
; You need to list the error code in unsigned decimal, followed by the message.
; Changes will take effect the next time you redisplay the variable.
[hresult]
;1234=my custom error code

     重新启动VS.Net 2003