delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/07/09/11:56:54

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Resent-Message-Id: <200307091556 DOT h69FuHW07756 AT aamail DOT fame DOT com>
Resent-Sender: sdowning AT wssfd DOT fame DOT com
Resent-To: cygwin AT cygwin DOT com
Resent-From: sdowning AT fame DOT com (Stuart F. Downing)
Resent-Date: 09 Jul 2003 11:55:01 -0400
X-From-Line: nobody Wed Jul 9 11:53:29 2003
To: cygwin AT cynwin DOT com
Subject: Problem including MinGW's float.h
From: sdowning AT fame DOT com (Stuart F. Downing)
Date: 09 Jul 2003 11:53:25 -0400
Message-ID: <ezel0zzoga.fsf@wssfd.fame.com>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1
MIME-Version: 1.0
Lines: 91

I'm trying to compile code that calls _controlfp which is declared in
/usr/include/mingw/float.h, but when I include float.h, gcc doesn't
find the mingw float.h first, it finds the gcc header first.

Here is the code

<CODE>
#include <float.h>

int main()
{
    unsigned int uiFPControl;
    unsigned int uiFPNewControl;

    uiFPControl = _controlfp( 0 , 0 );
    uiFPControl |= _EM_ZERODIVIDE;
    uiFPNewControl =  _controlfp( uiFPControl , _MCW_EM );
}
</CODE>

gcc -v -mno-cygwin -c foo.c

produces this...

<OUTPUT>
Reading specs from /usr/lib/gcc-lib/i686-pc-mingw32/3.2/specs
Configured with: /netrel/src/gcc-3.2-3/configure --enable-languages=c,c++,f77,java --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --without-included-gettext --enable-interpreter --disable-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-pc-cygwin --target=i686-pc-cygwin --enable-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin
Thread model: posix
gcc version 3.2 20020927 (prerelease)
 /usr/lib/gcc-lib/i686-pc-mingw32/3.2/cc1.exe -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -D_X86_=1 -D_X86_=1 -Asystem=winnt -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ -D__tune_pentium2__ -D__tune_pentium3__ -D__stdcall=__attribute__((__stdcall__)) -D__fastcall=__attribute__((__fastcall__)) -D__cdecl=__attribute__((__cdecl__)) -D_stdcall=__attribute__((__stdcall__)) -D_fastcall=__attribute__((__fastcall__)) -D_cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386__ -D__i386 -D__MSVCRT__ -D__MINGW32__ -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -DWINNT -isystem /usr/lib/gcc-lib/i686-pc-mingw32/3.2/../../../../include/w32api -isystem /usr/lib/gcc-lib/i686-pc-mingw32/3.2/../../../../i686-pc-mingw32/lib/../../include/w32api foo.c -quiet -dumpbase foo.c -mno-cygwin -version -o /cygdrive/c/DOCUME~1/sdowning/LOCALS~1/Temp/cc3uqCbc.s
GNU CPP version 3.2 20020927 (prerelease) (cpplib) (80386, BSD syntax)
GNU C version 3.2 20020927 (prerelease) (i686-pc-cygwin)
	compiled by GNU C version 3.2 20020927 (prerelease).
ignoring nonexistent directory "/usr/local/include/mingw/mingw"
ignoring nonexistent directory "/usr/i686-pc-mingw32/include/usr/include/mingw"
ignoring duplicate directory "/usr/i686-pc-mingw32/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/w32api
 /usr/lib/gcc-lib/i686-pc-cygwin/3.2/include
 /usr/include/mingw
End of search list.
foo.c: In function `main':
foo.c:9: `_EM_ZERODIVIDE' undeclared (first use in this function)
foo.c:9: (Each undeclared identifier is reported only once
foo.c:9: for each function it appears in.)
foo.c:10: `_MCW_EM' undeclared (first use in this function)
</OUTPUT>

gcc -E -mno-cygwin foo.c

produces 

<OUTPUT>
# 1 "foo.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "foo.c"
# 1 "/usr/lib/gcc-lib/i686-pc-cygwin/3.2/include/float.h" 1 3
# 2 "foo.c" 2

int main()
{
    unsigned int uiFPControl;
    unsigned int uiFPNewControl;

    uiFPControl = _controlfp( 0 , 0 );
    uiFPControl |= _EM_ZERODIVIDE;
    uiFPNewControl = _controlfp( uiFPControl , _MCW_EM );
}
</OUTPUT>

Clearly from the include order in the -v output and -E output, the
compiler is not finding the mingw float.h first.  Looking at float.h,
it #include_next's float.h, so clearly it is designed to supercede the
system header.

I'm able to work around this by explicitly adding -I/usr/include/mingw
to the command line, but this produces an ugly warning message...

cc1: warning: changing search order for system directory "/usr/include/mingw"
cc1: warning:   as it has already been specified as a non-system directory

I'm using the 1.3.22-1 cygwin setup/install and installed both gcc
3.2-3 and gcc-mingw.

Is this an installation problem?
-- 
Stuart Downing
sdowning at sign fame dot goes here com



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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019