2010-09-08 104 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