2010-09-08 103 views
1

我使用gSOAP以及Qt for Symbian。无法编译使用gSOAP的Qt Symbian应用程序

在模拟器下,应用程序编译正常,但是当我更改编译器的目标以编译设备时,出现以下错误。

WARNING: Can't find following headers in System Include Path 
<netinet\tcp.h> 

这被从stdsoap2.h文件包括以下几个方面:

#ifndef WITH_NOIO 
# ifndef WIN32 
# ifndef PALM 
# include <sys/socket.h> 
# ifdef VXWORKS 
# include <sockLib.h> 
# include <selectLib.h> 
# ifndef _WRS_KERNEL 
#  include <strings.h> 
# endif 
# else 
# ifndef SYMBIAN 
#  include <strings.h> 
# endif 
# endif 
# ifdef SUN_OS 
# include <sys/stream.h>  /* SUN */ 
# include <sys/socketvar.h>  /* SUN < 2.8 (?) */ 
# endif 
# ifdef VXWORKS 
# ifdef _WRS_KERNEL 
#  include <sys/times.h> 
# endif 
# else 
# include <sys/time.h> 
# endif 
# include <netinet/in.h> 
# ifdef OS390 
# include <netinet/tcp_var.h> 
# else 
#  include <netinet/tcp.h>   /* TCP_NODELAY */ 
# endif 
# include <arpa/inet.h> 
# endif 
# endif 
#endif 

我难倒!该文件无法找到任何地方..

回答

2

为了最终使其工作,我不得不端口gSOAP的使用stdapis而不是libc。我删除了其中一条<netinet\tcp.h>行,并使用<sys/select.h>代替。

您可以在http://pastebin.com/xnrDbfFa找到已移植的stdsoap2.h文件。

我也发现Symbian默认不加载STL,因此我所有返回std::vectorstd::string的方法现在都不在编译。

而是选择了-s标志禁用STL的使用,我加入了Symbian STL端口到INCLUDEPATH.pro文件像这样

symbian { 
    INCLUDEPATH += $$EPOCROOT\epoc32\include\stdapis\stlport 
    INCLUDEPATH += $$EPOCROOT\epoc32\include\stdapis\stlport\stl 
} 

而在soapStub.h我必须包括

#include <vector> 
#include <string> 

此外,您应该修改您的typemap.dat并添加以下内容以便能够编译。

# Symbian specific 
xsd__dateTime = | std::string 
xsd__long = | long 
xsd__unsignedLong = | unsigned long 
xsd__int = | int 

否则编译器会抱怨

'soap_outdateTime' was not declared in this scope 
'soap_indateTime' was not declared in this scope 

因为Symbian下,gSOAP的是建立与WITH_LEAN标志,因此,一些东西被禁用(例如,不支持time_t序列化和无支持LONG64/ULONG64序列化),因此所需的typemap.dat覆盖上面。

最后,以供将来参考,这里的命令行参数,我用生成的文件:

wsdl2h.exe -o service.h http://myservicelocation.com/DataDisplayingWCF.svc?wsdl 

然后:

soapcpp2.exe -I "C:\gsoap-2.7\gsoap\custom;C:\gsoap-2.7\gsoap\import" "service.h" -ixw 

您可能还需要建立在命名空间typemap.dat并使用wsdl2h再生。

+0

嘿,thx为您的答案,它已经帮了很多,只是我仍然不断收到错误soap_outdateTime和soap_indateTime,你可以发布你的typemap.dat文件吗? – Berty 2011-05-30 13:43:57

+0

不幸的是,我无法再访问该文件。 – sabbour 2011-06-07 09:51:04

+0

我遵循你的所有指示,但我不断收到'soap_outdateTime'的错误,任何想法我做错了什么? – Berty 2011-07-13 15:05:15

2

这头由S60 SDK提供的,并且在这里位于:

%EPOCROOT%\epoc32\include\libc\netinet\tcp.h 

为了正确地解决#include <netinet\tcp.h>因此,您的MMP文件需要包含以下行:

SYSTEMINCLUDE /epoc32/include/libc 
+0

你碰巧知道如何在.pro文件中编写这个文件吗? 我试过以下,但它没有工作: INCLUDEPATH + =/epoc32/include/libc – sabbour 2010-09-08 14:50:52

+0

我刚刚测试添加'INCLUDEPATH + =/epoc32/include/lib'到我的.pro文件,运行qmake,和生成的.mmp文件包含'SYSTEMINCLUDE/epoc32/include/libc'。你使用的是什么版本的Qt? – 2010-09-09 07:53:52

+0

我正在使用4.6.3 – sabbour 2010-09-10 19:29:05