Building with -std=c++0x causes __STRICT_ANSI__ to be defined. The new C++
headers expect the system C headers (ctype.h, stdio.h, etc.,) to declare
certain functions (isblank(), snprintf(), etc.) that are part of C++0x. The
system C headers that are part of cygwin aren't privy to this. The result is
that simple programs like the following to not compile with -std=c++0x on a
stock cygwin install.

  #include <iostream>
  int main() {}

The error is:

In file included from
/usr/local/gcc-4.3-20071030/lib/gcc/i686-pc-cygwin/4.3.0/../../../../include/c
++/4.3.0/cctype:98,
                 from
/usr/local/gcc-4.3-20071030/lib/gcc/i686-pc-cygwin/4.3.0/../../../../include/c
++/4.3.0/bits/localefwd.h:49,
                 from
/usr/local/gcc-4.3-20071030/lib/gcc/i686-pc-cygwin/4.3.0/../../../../include/c
++/4.3.0/ios:47,
                 from
/usr/local/gcc-4.3-20071030/lib/gcc/i686-pc-cygwin/4.3.0/../../../../include/c
++/4.3.0/ostream:45,
                 from
/usr/local/gcc-4.3-20071030/lib/gcc/i686-pc-cygwin/4.3.0/../../../../include/c
++/4.3.0/iostream:45,
                 from main.cpp:1:
/usr/local/gcc-4.3-20071030/lib/gcc/i686-pc-cygwin/4.3.0/../../../../include/c++/4.3.0/tr1_impl/ccty
pe:43: error: '::isblank' has not been declared



For another example, the following program also does not compile on cygwin with
-std=c++0x:


  #include <cstdio>

  int main()
  {
    char buf[50];
    snprintf(buf, 50, "hello");
  }


main.cpp: In function 'int main()':
main.cpp:6: error: 'snprintf' was not declared in this scope


This is with a stock g++ built on cygwin from latest source from svn,
configured with "--prefix=/usr/local/g++-4.3 --enable-languages=c,c++".


-- 
           Summary: -std=c++0x causes undeclared symbols errors on cygwin
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eric dot niebler at gmail dot com
  GCC host triplet: cygwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34032

Reply via email to