Search code examples
c++qtgsoap

gSoap client side, LNK2019, Qt


I am kinda new (only know how to generate semi-working server) to gSoap.And as such to client side of gSoap, so i have problem with multiple LNK2019.

But, first things first

First of all, i generated the KursServer.h with this command:

wsdl2h -s -o KursServer.h KursWeb.wsdl

KursWeb.wsdl was generated, then i developed my server, and was created from my header with neceseary functions, and he works fine with me.

here is the "code" of this file:

//gsoap WebFunctions service name: KursWeb
//gsoap WebFunctions service location: http://192.168.0.101:18083
int WebFunctions__delivered(char* UCID, char* DeviceNum, void);
int WebFunctions__established(char* UCID, char* DeviceNum, void);
int WebFunctions__connectionCleared(char* UCID,char* DeviceNum, void);
int WebFunctions__transfered(char* UCID, char* transNum1, char* transNum2, char* destenation, void);
int WebFunctions__holded(char* UCID, char* DeviceNum, void);
int WebFunctions__retrieved(char* UCID, char* DeviceNum, void);
int WebFunctions__setContextParametr(char* UCID, char* DeviceNum, char* Parametr, void);
int WebFunctions__getContextParametr(char* UCID, char* DeviceNum, char* result);
int WebFunctions__contextCheck(char* UCID, bool& ok);

Afther that i did this command:

soapcpp2 -i -C -L -IC:/Users/Senso/Desktop/gsoap_2.8.30/gsoap-2.8/gsoap/import KursServer.h

and created some client - side stuff: soapKursWebProxy(h and cpp), soapH, soapC, and also included stdsoap2 (h and cpp)

after this, i created my Qt project, included all files (they all at the same soap folder inside my project) and all includings, as i did for server -

main.cpp

#include "mainwindow.h"
#include <QApplication>
#include "soap/KursWeb.nsmap"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "soap/soapKursWebProxy.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    /*just test*/

}

mainwindow.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QDebug>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;

};

#endif // MAINWINDOW_H

And after i tried to compile this, i get tons of errors, like this (all referenced to ns1):

soapKursWebProxy.obj:-1: error LNK2019: unresolved external symbol "void __cdecl soap_serialize___ns1__contextCheck(struct soap *,struct __ns1__contextCheck const *)" (?soap_serialize___ns1__contextCheck@@YAXPEAUsoap@@PEBU__ns1__contextCheck@@@Z) в функции "public: virtual int __cdecl KursWebProxy::contextCheck(char const *,char const *,class _ns2__contextCheck *,class _ns2__contextCheckResponse &)" (?contextCheck@KursWebProxy@@UEAAHPEBD0PEAV_ns2__contextCheck@@AEAV_ns2__contextCheckResponse@@@Z)

and like this:

soapKursWebProxy.obj:-1: error LNK2019:  unresolved external symbol soap_faultstring referenced in function "public: virtual char const * __cdecl KursWebProxy::soap_fault_string(void)" (?soap_fault_string@KursWebProxy@@UEAAPEBDXZ)

and VERY strange like this:

stdsoap2.obj:-1:  error LNK2019: unresolved external symbol soap_faultcode referenced in function soap_set_fault

Should i define all my functions, like i did back at server side, or how i need to handle them?

Thank you in advance!

EDIT: Tryed to use MinGw compiler, gave me

C:\Users\Senso\Documents\Client_MVSC_Kurs_III\soap\stdsoap2.cpp:12627: error: 'wctomb_s' was not declared in this scope
             wctomb_s(&m, buf, sizeof(buf), (wchar_t)(c & 0x7FFFFFFF));
                                                                 ^

Also, some other MSVC compilers just crashes on build


Solution

  • Suddenly i resolve it - i used the "bad" compiler, bcs after reinstall Qt evrything worked just fine. Love Qt for this errors.