Re: C++11
"LeJacq, Jean Pierre" <[email protected]>
| Newsgroups | gmane.comp.version-control.monotone.devel |
|---|---|
| Organization | Quoin Inc |
| Message-ID | <25463283.3XyaGguOKX@qi32zz3s1> |
On Friday 16 May 2014 13:16:11 Stephen Leake wrote: > Compiling with cygwin > > g++ --version > g++ (GCC) 4.8.2 > > g++ -I. -I../monotone -I/usr/include/botan-1.10 -g -O2 -Wall > -Wextra -Wno-unused -Wno-unused-parameter -std=c++11 -MT src/unix/process.o > -MD -MP -MF $depbase.Tpo -c -o src/unix/process.o > ../monotone/src/unix/process.cc &&\ mv -f $depbase.Tpo $depbase.Po > ../monotone/src/unix/process.cc: In function ‘pid_t process_spawn_pipe(const > char* const*, FILE**, FILE**)’: ../monotone/src/unix/process.cc:264:29: > error: ‘fdopen’ was not declared in this scope *in = fdopen(infds[1], "w"); > > fdopen should be in stdio.h, and '#include <stdio.h> is present. > > The error goes away if I delete '-std=c++11'. Or if I change it to gnu++11! This is expected behavior. Setting the language level to -std='c++11' enables strict ISO C++ library support. fdopen() is not part of the C11 or C++11 standards. Instead it is a POSIX function. I've found that this "feature" of gcc quite helpful to uncover implicit dependencies on POSIX. If POSIX features are desired, you can either use another language level for the -std option or you can enable a number of macros that glibc understand depending on the POSIX level you want. -D'_POSIX_SOURCE=1' -D'_POSIX_C_SOURCE=200809L' -D'_XOPEN_SOURCE=700' -D'_XOPEN_SOURCE_EXTENDED=1' GNU extensions can then be enabled using: -D'_GNU_SOURCE=1' -- JP _______________________________________________ Monotone-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/monotone-devel