cgsoap

Undefined references when compiling gSOAP client


I'm trying to create a client for a web service in C. I was generated C files with the wsdl2h and soapcpp2. In netbeans I'm added the generated files and the gSOAP include dir to the project's include directories. my main file looks like this:

#include <stdio.h> 
#include <stdlib.h>
#include <soapH.h>
#include <webserviceSoap12.nsmap>

int main(int argc, char** argv) {

    struct soap *soap1 = soap_new();
    struct _ns1__getAllCustomer *quote;
    struct _ns1__getAllCustomerResponse *quote2;
    if (soap_call___ns2__getAllCustomer(soap1, NULL, NULL, quote, quote2) == SOAP_OK)
        printf("asd\n");
    else // an error occurred  
        soap_print_fault(soap1, stderr); // display the SOAP fault on the stderr stream
    return (EXIT_SUCCESS);
}

I copied the most of this from the gSOAP website's getting started section. When I try to compile i get the following error:

build/Debug/MinGW-Windows/main.o: In function `main':
\NetBeansProjects\WebServiceClient/main.c:19: undefined reference to `soap_new_LIBRARY_VERSION_REQUIRED_20808'
\NetBeansProjects\WebServiceClient/main.c:22: undefined reference to `soap_call___ns2__getAllCustomer'
\NetBeansProjects\WebServiceClient/main.c:25: undefined reference to `soap_print_fault'

If I add the "soapC.c" "soapClient.c" "soapClientLib.c" files to the project I get a bunch of more undefinied reference. What am I doing wrong? I'm using Netbeans ide with MinGW compiler on Win7. What other libraries I need or what other files should I include?


Solution

  • I managed to solve the problem by adding the files "soapC.c" "soapClient.c" "stdsoap.c" to the project files and in the Project propertie - Include Directories adding the files generated by soapcpp2 and the gSOAP toolkit's gsoap directory