This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Case-sensitivity for #include with gcc



    Just consider the simple C program tstl.c

#include <stdio.h>
#include <string.h>

int main()
{
   locale_t ll ;
   ll=0 ;
   printf("locale=%d\n",(int)ll) ;
   return 0 ;
}

The compilation with the command
   gcc -Wall -O2 -o tstl.exe tstl.c
is successful and the execution as well.

Now the compilation with:
   gcc -Wall -O2 -o tstl.exe -I /usr/include/X11   tstl.c
fails with the following messages:

In file included from /usr/include/X11/xlocale.h:35:0,
                  from /usr/include/string.h:20,
                  from tstl.c:2:
/usr/include/locale.h:86:1: erreur : unknown type name « locale_t »
  locale_t newlocale (int, const char *, locale_t);
  ^~~~~~~~
/usr/include/locale.h:86:40: erreur : unknown type name « locale_t »
  locale_t newlocale (int, const char *, locale_t);
                                         ^~~~~~~~
/usr/include/locale.h:88:1: erreur : unknown type name « locale_t »
  locale_t duplocale (locale_t);
  ^~~~~~~~
/usr/include/locale.h:89:1: erreur : unknown type name « locale_t »
  locale_t uselocale (locale_t);
  ^~~~~~~~
In file included from /usr/include/string.h:24:0,
                  from tstl.c:2:
/usr/include/strings.h:73:48: erreur : unknown type name « locale_t »
  int  strcasecmp_l (const char *, const char *, locale_t);
                                                 ^~~~~~~~
/usr/include/strings.h:74:57: erreur : unknown type name « locale_t »
  int  strncasecmp_l (const char *, const char *, size_t, locale_t);
                                                          ^~~~~~~~
In file included from tstl.c:2:0:
/usr/include/string.h:55:45: erreur : unknown type name « locale_t »
  int  strcoll_l (const char *, const char *, locale_t);
                                              ^~~~~~~~
/usr/include/string.h:56:24: erreur : unknown type name « locale_t »
  char *strerror_l (int, locale_t);
                         ^~~~~~~~
/usr/include/string.h:57:70: erreur : unknown type name « locale_t »
  size_t  strxfrm_l (char *__restrict, const char *__restrict, size_t,
locale_t);
^~~~~~~~
tstl.c: Dans la fonction « main »:
tstl.c:6:3: erreur : unknown type name « locale_t »
    locale_t ll ;
    ^~~~~~~~

The reason is that string.h includes now /usr/include/X11/Xlocale.h
instead of /usr/include/xlocale.h

How can I force the right include, as I need anyway /usr/include/X11 for
other functions ? I did all the following attempts without sucess:

1) I tried
   gcc -Wall -O2 -o tstl.exe -I /usr/include -I /usr/include/X11   tstl.c
      why the left to right precedence of -I does not work ?
2) I tried to base the selection on the case-sensitivity by setting
      CYGWIN=check_case:strict     or by  defining a mount point
      with posix=1 in /etc/fstab, then stopping and restarting
      Cygwin.
      I don't understand why the preprocessor does not apply a strict case
      sensitivity, although under Windows, as I would expect from
      sake of portability.

I found a successful  trick:
 gcc -Wall -O2 -o tstl.exe -idirafter /usr/include/X11   tstl.c
but I don't like it because I would like to solve the problem for a big
software which is distributed with a configure. Therefore I'm seeking
for a general solution. In particular is there a way to force the
case-sensitivity for the selection of files included by the preprocessor ?

Thank you for any idea.

Here attached is the cygcheck -s -r output, and I'm using
i686-pc-cygwin   6.4.0   on a W7 64 bits

 --

             ****************************************
             *   Laurent TASSAN-GOT                 *
             *   CERN/EP-UNT                        *
             *   603-R-011                          *
             *   385 route de Meyrin                *
             *   1217 Meyrin, Switzerland           *
             *   email : Laurent.Tassan.Got@cern.ch *
             *   tel: +41 75 411 00 62              *
             ****************************************



Attachment: cygcheck.out
Description: Text document

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]