到目前为止,Ice的最新版本是3.4.1。

不过Ice3.1.1是Zeroc发布的最后一个支持windows2000的官方版本。为了兼容windows2000,我不得不把我的程序分成2个版本,一个用vs2008+ice3.4进行编译。

一个用vc6.0+3.1.1进行编译。

中间遇到不少问题,归纳如下。

1、在使用Ice3.1.1 源码版本时,需要先对Ice3.1.1进行编译。

    编译方法: 用vc6打开源码下面的all.dsw, 打开tools->option->Directories.设置Ice的 include目录,lib目录,bin目录

       编译all的时候include目录不能够包含2003 psdk的路径,否则会报很多错误,如果你实在需要使用2003psdk,那么最好先删除psdk的include路径,等编译完成之后再加进来。

 

2、程序编译

 Ice编译完成之后,对自己写的代码编译,如果自己的代码用到了2003psdk的话,这时候把sdk的include路径包含进来,另外不要忘记stlport的include路径。如果编译出现错误

C:\ICE-3.1.1-THIRDPARTY-VC60\INCLUDE\STLPORT\stl/_threads.h(181) : error C2733: second C linkage of overloaded function 'InterlockedIncrement' not allowed
        C:\ICE-3.1.1-THIRDPARTY-VC60\INCLUDE\STLPORT\stl/_threads.h(181) : see declaration of 'InterlockedIncrement'

则需要打开C:\Ice-3.1.1-ThirdParty-VC60\include\stlport\stl_user_config.h

 将这2个开关打开

/*
 * You should define this macro if compiling with MFC - STLport <stl/_config.h>
 * then include <afx.h> instead of <windows.h> to get synchronisation primitives
 *
 */

 # define _STLP_USE_MFC 1 //不用mfc的可以不管这个


// boris : this setting is here as we cannot detect precense of new Platform SDK automatically
// If you are using new PSDK with VC++ 6.0 or lower, please define this to get correct prototypes for InterlockedXXX functions
# define _STLP_NEW_PLATFORM_SDK 1

 

另外还有一些常见错误的编译选项目,比如Project->Setting->link里面library modules:Ice.lib IceUtil.lib

Project Options  /GR /MDd

Project->Setting->C/C++里面的Project Options:_WIN32_WINNT=0X500

 

另外我还遇到一个问题,debug版本没有任何问题,但是用release版本一运行就出错。

后来发现是我在release版本里面用了/MDd参数进行编译, 在release版本中应该使用/MD

看来当初出现问题的时候没有了解这个参数具体的意思,现在才终于整明白了。

 

posted on 2010-06-12 11:15  飞天名猪  阅读(496)  评论(0编辑  收藏  举报