在 Win 7 上使用 gsoap 和 Qt 4.6 编译示例应用程序
我正在尝试编译 gsoap 网站 但没有成功。 这是我的 .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'
我似乎缺少一些网络库。有人可以帮我编译这个例子吗?
谢谢。
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: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'
It seems that I am missing some network library. Can someone please help me compile this example.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
已解决:
我应该早点看看这篇文章。它解决了我的问题。
我的不好。
为了完整起见,我只是复制该帖子中的解决方案。
** 将 LIBS += C:\MinGW\lib\libws2_32.a 添加到您的 *.pro 文件中。 libws32_a 是已弃用的 libwsock32.a 文件的当前版本。 **
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. **
您也可以只添加“LIBS += -lws2_32”,编译器应该为您找到正确的库路径。
You can also just add "LIBS += -lws2_32", the compiler should find the correct path to the library for you.