Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#182 strcasecmp undeclared in cygwin

open
David Sugar
5
2004-04-17
2004-04-02
Ted Percival
No

Tested with version 1.1.2

When compiling a project which includes <cc++/socket.h>
under cygwin, a compiler error occurs:

/usr/local/include/cc++/strchar.h: In member function
`virtual int
ost::keystring::compare(const char*)':
/usr/local/include/cc++/strchar.h:103: error:
`strcasecmp' undeclared (first
use this function)

This can be tested with the following code:

// sample code start
#include <cc++/socket.h>

int main(void) {
return 0;
}
// sample code end

I'm not a seasoned C or C++ programmer, but was able to
bypass the error by inserting the following code into
/usr/local/include/cc++/strchar.c on line 71 (just
after the end of the "#ifdef HAVE_STRCASECMP" block)

// code start
#undef stricmp
#define stricmp(x, y) strcmp(x, y)

#undef strnicmp
#define strnicmp(x, y) strncmp(x, y)
// code end

Discussion

  • Ted Percival
    Ted Percival
    2004-04-02

    Logged In: YES
    user_id=1011928

    The line in strchar.h on which the error occurs (103)
    contains this code:

    {return stricmp(c_str, s2);};

     
  • Ted Percival
    Ted Percival
    2004-04-02

    Logged In: YES
    user_id=1011928

    Clarification: I inserted the code into strchar.h *not*
    strchar.c

    I'm sure my mistake was quite obvious, but I'm posting this
    follow up to be sure.

     
  • David Sugar
    David Sugar
    2004-04-17

    • labels: --> Win32 Target
    • assigned_to: nobody --> dyfet
     
  • David Sugar
    David Sugar
    2004-04-17

    Logged In: YES
    user_id=217

    strcasecmp functions are typical in gnu systems. Generally the
    configure script tests for strcasecmp in the libc, and if it finds it,
    uses strcasecmp and reroutes the stricmp functions to that. My
    question is rather why the configure script is reporting libc has a
    strcasecmp function when either the cygwin libc doesn't, or
    doesn't impliment a header definition for it. I would look for
    strcasecmp in the /usr/include/string.h headers on cygwin, and
    see if there is any specific #define that might disable/skip
    strcasecmp function definitions.