gloox 1.0的 wince编译

在windows mobile6下编译通过。

1、建立工程。

新建一个mobile空工程。

加进文件就不多说了,将gloox的头文件、和cpp加进目录。

2、配置工程编译属性。

将下载的gloox目录下的config.h.win拷贝一份到工程目录下(不是解决方案目录,这样做的目的是便于以后随便拷贝这个现成的gloox mobile工程)。

配置config.h.winmobile平台貌似sasltls会有点小问题,所以先不用这两个,先编译通过再说,后续再修改。将ssltls都注释掉,剩下的文件内容如下:

 

/* Comment out if you don't have the `setsockopt' function. Usually available. */

#define HAVE_SETSOCKOPT 1

#ifdef _MSC_VER

#pragma comment( lib, "Dnsapi.lib" )

#pragma comment( lib, "Secur32.lib" )

#pragma comment( lib, "Crypt32.lib" )

//#pragma comment( lib, "ws2_32.lib" )

#pragma comment( lib, "ws2.lib" )

#pragma comment( lib, "winsock.lib" )

 

/* The following silences a few C4355 warnings ('this' : used in member initializer list).

   This is only used with Parser which doesn't do anything with its TagHandler in the ctor,

   so muting C4355 is safe. */

#pragma warning( disable : 4355 )

 

/* The following silcences warnings concerning "unsafe" functions (sprintf, strncpy, etc.).

   They are used in a safe way here, though. */

#pragma warning( disable : 4996 )

#endif

改完了以后打开config.h,将config.h.win的目录由“../ config.h.win”改成“config.h.win

 

2、设置工程属性。

这个根据需要自己配置一下,现在编译应该不用改也可以编译过,加到其他解决方案的时候可能会有问题,到时候看具体问题再具体改吧。

3、编译。

此时编译仍然会报错。解决如下:

1/dns.cpp(346) : error C3861: 'getprotobyname': identifier not found

添加# include <winsock2.h>

添加#include <sstream>

2error C2039: 'time' : is not a member of 'std'

std::time(0)改为time(0)         去掉std

3clientbase.cpp(502) : error C2440: '=' : cannot convert from 'unsigned char *' to 'unsigned short *'

 

4const std::string ClientBase::getID()time没实现

改成:

#ifdef _WIN32_WCE

    char r[8+1];

    sprintf( r, "%08x", rand() );

    std::string ret( r, 8 );

    return std::string( "uid" ) + ret;

#else

    std::ostringstream oss;

    oss << ++m_idCount;

    return std::string( "uid" ) + oss.str();

#endif

 

至此,gloox1.0上的mobile版本移植完毕。

可以去下载的gloox文件里找个例子跑一下。调例子的时候因为我们没有设置sasl和tls,所以需要将client的sasl和tls设置为false,才能正确登录。

以后有时间会更新添加sasl和tls的解决方案。

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值