Using gSoap in Qt/Windows

℡╲_俬逩灬. 提交于 2019-11-30 16:04:44

问题


I followed the steps on gSoap's page and tried to run the example code in Qt/Windows with Mingw32 Compiler. However, I can't add lgsoap++ to linker, as stated in the documentation, since it is not in the source package

To complete the build, compile and link the generated soapC.cpp, soapcalcProxy.cpp, and the run-time gSOAP engine -lgsoap++ (or use source stdsoap2.cpp in case libgsoap++.a is not installed) with your code.

Then I tried adding stdsoap2.cpp to SOURCES and this is the compile output as a result. So my question is how I will run this example code snippet in Qt with Mingw32 compiler or how I will generate that lgsoap++. Followings are my pro and source files:

QT -= gui
TARGET = SoapCalc
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp \
    ../Console/gsoap/stdsoap2.cpp
OTHER_FILES += ../../../../../gsoap/gsoap-2.7/gsoap/calc.nsmap
HEADERS += ../../../../../gsoap/gsoap-2.7/gsoap/soapcalcProxy.h


#include"C:/gsoap/gsoap-2.7/gsoap/soapcalcProxy.h"
#include"C:/gsoap/gsoap-2.7/gsoap/calc.nsmap"


int main(int argc, char *argv[])
{
    calcProxy service;
    return 0;
}

回答1:


Finally, I have resolved it. Follow the guidelines on the gSoap's page. Add the following files to your project: generated *.cpp, *.h, *.nsmap, service definition file - the name of which you type on command line e.g. calc.h in the guideline - and stdsoap2.h/cpp files in the gsoap directory of the downloaded zip file. After including proxy file -e.g. soapcalcProxy.h - and *.nsmap to your main file there remains one thing that I forgot to realize before:

add LIBS += C:\MinGW\lib\libws2_32.a to your *.pro file. libws32_a is the current version of the deprecated libwsock32.a file.



来源:https://stackoverflow.com/questions/2795760/using-gsoap-in-qt-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!