Menu

#1098 fatal error: xlocale.h: No such file or directory

v1.0 (example)
closed-works-for-me
5
2017-03-01
2017-01-26
io
No

I followed https://www.genivia.com/dev.html#client-cpp tutorial.
wsdl2h -o calc.h http://www.genivia.com/calc.wsdland
soapcpp2 -j -CL -I/path/to/gsoap/import calc.h worked. but
c++ -o calcclient calcclient.cpp soapC.cpp soapcalcProxy.cpp stdsoap2.cppcommand returns error

In file included from soapStub.h:22:0,
                 from soapH.h:16,
                 from calc.nsmap:2,
                 from calcclient.cpp:1:
stdsoap2.h:651:23: fatal error: xlocale.h: No such file or directory
compilation terminated.
In file included from soapStub.h:22:0,
                 from soapH.h:16,
                 from soapC.cpp:19:
stdsoap2.h:651:23: fatal error: xlocale.h: No such file or directory
compilation terminated.
In file included from soapStub.h:22:0,
                 from soapH.h:16,
                 from soapcalcProxy.h:16,
                 from soapcalcProxy.cpp:14:
stdsoap2.h:651:23: fatal error: xlocale.h: No such file or directory
compilation terminated.
In file included from stdsoap2.cpp:60:0:
stdsoap2.h:651:23: fatal error: xlocale.h: No such file or directory
compilation terminated.

I installed mingw but there is no xlocale.h file in my PC. Why this happen ?
I am using windows7

Discussion

  • Robert van Engelen

    In this case compile with -DWITH_NO_C_LOCALE to remove locale support. See documentation.

    Or perhaps you can try to change stdsoap2.h:668 #ifdefs to make it work with MINGW:

    #ifdef WITH_C_LOCALE
    # include <locale.h>
    # if defined(WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
    #  define SOAP_LOCALE_T _locale_t
    #  define SOAP_LOCALE(soap) ((soap)->c_locale ? (soap)->c_locale : ((soap)->c_locale = _create_locale(LC_ALL, "C")))
    #  define SOAP_FREELOCALE(soap) (void)((soap)->c_locale && (_free_locale((soap)->c_locale), ((soap)->c_locale = NULL)))
    # else
    #  include <locale.h>
    #  include <xlocale.h>
    #  define SOAP_LOCALE_T locale_t
    #  define SOAP_LOCALE(soap) ((soap)->c_locale ? (soap)->c_locale : ((soap)->c_locale = newlocale(LC_ALL_MASK, "C", NULL)))
    #  define SOAP_FREELOCALE(soap) (void)((soap)->c_locale && (freelocale((soap)->c_locale), ((soap)->c_locale = NULL)))
    # endif
    #else
    # undef HAVE_STRTOF_L
    # undef HAVE_STRTOD_L
    # undef HAVE_SSCANF_L
    #endif
    
     
  • Robert van Engelen

    • status: open --> open-accepted
    • assigned_to: Robert van Engelen
     
  • io

    io - 2017-01-28

    -DWITH_NO_C_LOCALE is not working for me. And if I changed ifdefs I get error because of _create_locale and _free_locale

    C:\Users\user\Desktop\gSoapCalc>c++ -o calcclient calcclient.cpp soapC.cpp soapcalcProxy.cpp stdsoap2.cpp -DWITH_NO_C_L
    OCALE
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x18a): undefined reference to `sendto@24'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x1b5): undefined reference to `send@16'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x279): undefined reference to `sendto@24'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x2a4): undefined reference to `send@16'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x2ed): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x341): undefined reference to `send@16'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x35d): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0xc31): undefined reference to `recvfrom@24'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0xc56): undefined reference to `ntohl@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0xc89): undefined reference to `recv@16'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0xca2): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5905): undefined reference to `WSAStartup@8'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x59dc): undefined reference to `inet_addr@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5a3f): undefined reference to `gethostbyname@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5a50): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5bc3): undefined reference to `htons@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5c22): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5c33): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5cfa): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5d0b): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5e4a): undefined reference to `socket@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5e6e): undefined reference to `socket@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5e7f): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5f28): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5f39): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5fcd): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x5fe9): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6085): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x60a1): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6130): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x614c): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x61db): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x61f7): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6286): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x62a2): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6354): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6365): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6420): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6431): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6507): undefined reference to `htons@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6529): undefined reference to `bind@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x653a): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6650): undefined reference to `htons@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x66ec): undefined reference to `htons@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6756): undefined reference to `ioctlsocket@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x678a): undefined reference to `ioctlsocket@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x67b4): undefined reference to `connect@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x67c9): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x68b6): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x695e): undefined reference to `getsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6998): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6b2c): undefined reference to `ioctlsocket@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6b60): undefined reference to `ioctlsocket@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6d93): undefined reference to `select@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6da4): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6e30): undefined reference to `__WSAFDIsSet@8'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6e67): undefined reference to `__WSAFDIsSet@8'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6e9e): undefined reference to `__WSAFDIsSet@8'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6ef2): undefined reference to `accept@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6f87): undefined reference to `closesocket@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x6fa4): undefined reference to `shutdown@8'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x707a): undefined reference to `socket@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x70a6): undefined reference to `socket@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x70d4): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x717b): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7197): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7231): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x724d): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x72ca): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x72e6): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7363): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x737f): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x73fc): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7418): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7511): undefined reference to `htonl@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x752d): undefined reference to `htons@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7576): undefined reference to `bind@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7587): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x75f6): undefined reference to `listen@8'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7612): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7751): undefined reference to `recv@16'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x779d): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7a6a): undefined reference to `ntohl@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7aee): undefined reference to `ntohs@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7b6d): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7b7e): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7c0b): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7c27): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7cb7): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7cd3): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7d5b): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7d77): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7dff): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7e1b): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7e96): undefined reference to `setsockopt@20'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7ea7): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7f60): undefined reference to `ioctlsocket@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7f9a): undefined reference to `ioctlsocket@12'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x7fad): undefined reference to `WSAGetLastError@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x819d): undefined reference to `closesocket@4'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x81d2): undefined reference to `WSACleanup@0'
    C:\Users\user\AppData\Local\Temp\cc4PJTvE.o:stdsoap2.cpp:(.text+0x22c41): undefined reference to `recv@16'
    
     
  • Robert van Engelen

    Works fine in our tests:

    cc -Wall -Wunused -Wextra  -o calcclient calcclient.c stdsoap2.c soapC.c soapClient.c -DWITH_NO_C_LOCALE
    

    Perhaps this is a MingGW issue.

     
  • Robert van Engelen

    • status: open-accepted --> closed-works-for-me
     
  • io

    io - 2017-02-03

    Hi Robert,

    thanks for your response

    my C++ compiler is this

    c++ (GCC) 5.3.0
    Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    

    what is your cc compiler ? is it gcc or windows compiler ? Also you tested C version of library. is there possiblity of bug in C++ version ?

    thanks.

     

    Last edit: io 2017-02-03
  • Robert van Engelen

    Don't know. You have to figure out why compiling with -DWITH_NO_C_LOCALE fails. Look in the stdsoap2.cpp code for WITH_NO_C_LOCALE that #undefs WITH_C_LOCALE. Since WITH_C_LOCALE is turned off, all locale handling should be turned off.

     
  • io

    io - 2017-02-06

    Hi Robert,
    I found a website (http://planetcubicle.blogspot.com.tr/2013/10/building-c-gsoap-web-service-client.html) about gSoap compilation with mingw. it says I have to link against libws2_32.a.
    So if I compile with this commad, it works

    c++ -o calcclient calcclient.cpp soapC.cpp soapcalcProxy.cpp stdsoap2.cpp -DWITH_NO_C_LOCALE -lws2_32

    for your information.
    thanks for help.

     
  • Robert van Engelen

    Version 2.8.44 should fix the MinGW "missing xlocale.h" compilation error, at least it works on Cygwin too. And indeed, make sure to link against libws2_32.a as you suggested. The online installation docs are updated to reflect that.

     

Log in to post a comment.

MongoDB Logo MongoDB