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, s开发者_开发问答oapcalcProxy.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;
}
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.
精彩评论