iostream doesn't work (clang++)

Mark Geisert mark@maxrnd.com
Tue Jul 4 18:51:16 GMT 2023


Hi there,

ggl329 via Cygwin wrote:
> Hi,
> 
> clang++ fails with iostream.
> Does it go well in your environment?
> # I noticed that clang is orphaned. clang requires a maintainer?
> 
> 
> $ cat sample.cc
> #include <iostream>
> int main()
> {
>      std::cout << "Hello World.\n";
>      return 0;
> }
> 
> $ g++ sample.cc
> $ ./a
> Hello World.
> 
> $ clang++ sample.cc
> In file included from sample.cc:1:
> In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/iostream:39:
> In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ostream:38:
> In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ios:42:
> In file included from 
> /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/ios_base.h:39:
> In file included from 
> /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ext/atomicity.h:35:
> In file included from 
> /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/x86_64-pc-cygwin/bits/gthr.h:148:
> In file included from 
> /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/x86_64-pc-cygwin/bits/gthr-default.h:35:
> In file included from /usr/include/pthread.h:11:
> In file included from /usr/include/sys/types.h:221:
> In file included from /usr/include/sys/_pthreadtypes.h:12:
> /usr/include/sys/cpuset.h:45:24: error: use of undeclared identifier 
> '__builtin_malloc'; did you mean
>        '__builtin_alloca'?
>    return (cpu_set_t *) __builtin_malloc (CPU_ALLOC_SIZE(num));
>                         ^
> /usr/include/sys/cpuset.h:45:24: note: '__builtin_alloca' declared here
> /usr/include/sys/cpuset.h:52:3: error: use of undeclared identifier '__builtin_free'
>    __builtin_free (set);
>    ^
> 2 errors generated.
[...]

That's not a problem with <iostream>, but with <sys/cpuset.h>.  It did not 
anticipate being compiled with clang.  I will submit a patch.
Thanks for the report,

..mark


More information about the Cygwin mailing list