Compiling sample application using gsoap and Qt 4.6 on Win 7
I am trying to compile the calc example explained in gsoap website but no success. Here is what my .pro file looks.
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
When I compile the application I get 93 undefined references. Following are few of those
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:94开发者_开发百科1: 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'
It seems that I am missing some network library. Can someone please help me compile this example.
Thanks.
Solved: I should have looked at this post earlier. It solved my issue. My bad. Just am copying the solution from that post for sake of completeness.
** add LIBS += C:\MinGW\lib\libws2_32.a to your *.pro file. libws32_a is the current version of the deprecated libwsock32.a file. **
You can also just add "LIBS += -lws2_32", the compiler should find the correct path to the library for you.
精彩评论