Mail Archives: cygwin/2005/09/23/17:01:30
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 -