monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] C++11


From: LeJacq, Jean Pierre
Subject: Re: [Monotone-devel] C++11
Date: Fri, 16 May 2014 16:12:57 -0400
User-agent: KMail/4.12.4 (Linux/3.14-1-amd64; KDE/4.12.4; x86_64; ; )

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]