在Win 7上使用gsoap和Qt 4.6编译示例应用程序

时间:2011-04-05 16:51:41

标签: qt gsoap

我正在尝试编译gsoap website中解释的calc示例,但没有成功。 这是我的.pro文件的外观。

 QT += network \
    xml
QT -= gui
TARGET = gsoap_c
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp \
    soapcalcProxy.cpp \
    stdsoap2.cpp \
    soapC.cpp
HEADERS += soapcalcProxy.h \
    stdsoap2.h \
    soapH.h \
    calc.h
OTHER_FILES += calc.nsmap

当我编译应用程序时,我得到93个未定义的引用。以下是其中的一些

C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:593: undefined reference to `sendto@24'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:595: undefined reference to `send@16'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:629: undefined reference to `WSAGetLastError@0'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:933: undefined reference to `recvfrom@24'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:936: undefined reference to `ntohl@4'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:941: undefined reference to `recv@16'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:3557: undefined reference to `WSAStartup@8'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:3615: undefined reference to `inet_addr@4'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:3647: undefined reference to `gethostbyname@4'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:3728: undefined reference to `socket@12'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:3760: undefined reference to `setsockopt@20'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:3902: undefined reference to `htons@4'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:4310: undefined reference to `ioctlsocket@12'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:4400: undefined reference to `__WSAFDIsSet@8'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:4397: undefined reference to `select@20'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:4531: undefined reference to `closesocket@4'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:4542: undefined reference to `shutdown@8'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:4608: undefined reference to `socket@12'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:4699: undefined reference to `bind@12'
C:\Users\Drena\Desktop\project\qt\gsoap_c/stdsoap2.cpp:4956: undefined reference to `WSACleanup@0'

似乎我错过了一些网络库。有人可以帮我编译这个例子。

感谢。

2 个答案:

答案 0 :(得分:4)

解决: 我应该先看一下this帖子。它解决了我的问题。 我的错。 为了完整起见,我正在复制该帖子中的解决方案。

**将LIBS + = C:\ MinGW \ lib \ libws2_32.a添加到* .pro文件中。 libws32_a是已弃用的libwsock32.a文件的当前版本。 **

答案 1 :(得分:2)

您也可以添加“LIBS + = -lws2_32”,编译器应该为您找到正确的库路径。