delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/23/17:01:30

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Date: Fri, 23 Sep 2005 23:01:08 +0200 (MET DST)
From: Angelo Graziosi <Angelo DOT Graziosi AT roma1 DOT infn DOT it>
To: cygwin AT cygwin DOT com
Subject: Strange behaviour with g++ 3.4.4-1
Message-ID: <Pine.OSF.4.21.0509232252190.96-100000@ax0rm1.roma1.infn.it>
MIME-Version: 1.0


Rebuilding, with GCC 3.4.4-1, a few my Windows applications
(those that use -mwindows), I have found a compiler error that
was absent in the build with GCC 3.3.3-3.

I have created the simplest test case that reproduces the 'phenomenon'

----------------------------------------
//
// test.cpp
//
// Compile with:
//
//     g++ test.cpp -o test
//
#include <iostream>
#include <windows.h>
#include <complex>


using namespace std;

int main()
{
   cout << "Hello, World" << endl;

   return 0;
}

----------------------------------------


Trying to build, the result is:

----------------------------------------

$ g++ test.cpp -o test
In file included from
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/sstream:640,
                 from
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/complex:51,
                 from test.cpp:8:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:
In member function `virtual typename
std::basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
std::basic_stringbuf<_CharT, _Traits, _Alloc>::overflow(typename
_Traits::int_type)':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:102:
error: expected unqualified-id before '(' token
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:104:
error: expected unqualified-id before '(' token
In file included from test.cpp:8:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/complex:
In function `_Tp std::abs(const std::complex<_Tp>&)':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/complex:551:
error: expected unqualified-id before '(' token

----------------------------------------

It seems that the '#include <windows.h>' does not like to stay between
that of <iostream> and <complex>.

Moving it at the beginning or at the end , works. i.e. with the sequences


#include <windows.h>
#include <iostream>
#include <complex>

or

#include <iostream>
#include <complex>
#include <windows.h>

the build is completed without errors.

With GCC 3.3.3-3 the build works in any case.

With more complex applications (that have many includes which include
others etc.) is not simple to establish the order in which the inclusion
of windows.h apperars.


Best regards,

    Angelo.


--
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