Important: Please read the Qt Code of Conduct -

gSoap QT undefined reference

  • i'm trying to use gSOAP to create a server/client

    this is my Test.h file that i'm using

    //gsoap ns service name:    ColisageMutexService
    //gsoap ns service style:   rpc
    //gsoap ns service encoding:    literal
    //gsoap ns service location:    http://localhost:1444
    //gsoap ns schema namespace: urn:ColisageMutex
    class FamilleProduit
        int Id;
        std::string Libelle;
        int getId();
        void setId(int value);
        std::string getLibelle();
        void setLibelle(std::string value);
    //gsoap ns service method-action: ajouterByType ""
    int ns__ajouterByType ( FamilleProduit familleproduit, bool * result);
    //gsoap ns service method-action: ajouterByLibelle ""
    int ns__ajouterByLibelle ( std::string libelle, bool * result);

    I run soapcpp2.exe -I -pTest Test.h and I integrate the generated code with my project but the probleme that the compiler keep giving me errors

    error: undefined reference to ns__ajouterByType(soap*, FamilleProduit, bool*)


    error: undefined reference to ns__ajouterByLibelle(soap*, std::string, bool*)

    even that i added in my main the implement of this tow function

  • Hi,

    can you post your .pro file?
    The error is related to a missing module/library linked to the application

    PLEASE: Use code formatting (it makes the post more readable)

  • This is my pro file :

    QT       += core
    QT       -= gui
    QT       += sql
    QT       += network
    LIBS    += C:\Qt\Tools\mingw491_32\i686-w64-mingw32\lib\libws2_32.a
    TARGET = ServeurColisage
    CONFIG   += console
    CONFIG   -= app_bundle
    TEMPLATE = app
    SOURCES += main.cpp \
        typedocumentdao.cpp \
        typedocument.cpp \
        connexion.cpp \
        libelle.cpp \
        libelledao.cpp \
        familleproduit.cpp \
        familleproduitdao.cpp \
        stdsoap2.cpp \
        TestC.cpp \
    HEADERS += \
        typedocumentdao.h \
        includes.h \
        typedocument.h \
        connexion.h \
        crude.h \
        libelle.h \
        libelledao.h \
        familleproduit.h \
        familleproduitdao.h \
        stdsoap2.h \
        TestH.h \
        TestStub.h \

    thank you

  • Sorry i have no idea how to use code formatting

  • Moderators

    @MajdiKharroubi add your code after ``` (3 Backticks) and then end with the same. You can find more info here.

  • @p3c0 thank you

  • @mcosta hello I posted my .pro file can you help me please

  • Hi,

    where is ns__ajouterByType implemented??? I don't know so much gSoap but I see you don't link any libraries from it; is correct?

Log in to reply