<html><body><p><tt>Dmitri Gribenko <gribozavr@gmail.com> wrote on 06/02/2016 06:19:33 PM:<br>> <br>> Could you check if there are multiple definitions of off_t or mode_t<br>> in different headers guarded by macros? Something like this,<br>> duplicated across several headers:<br>> <br>> #if !defined(_OFF_T_DEFINED)<br>> typedef __off_t off_t;<br>> #define _OFF_T_DEFINED<br>> #endif<br>> <br>> This is a frequent pattern used in C headers, but it is an antipattern<br>> for modules. With modules, all headers that are included into the<br>> module get #included into a single translation unit and compiled into<br>> a module, so only one of those typedefs will get activated (let's say<br>> in foo.h), and the other one will get hidden because it is seen second<br>> in the translation unit (let's say the one in bar.h gets hidden). If<br>> you then import just the submodule for bar.h, the off_t definition<br>> won't be visible, because it was #ifdef'ed out.<br>> <br>> There are fragile solutions to this (like including a header that<br>> happens to fix the build this time), but the only real fix is to make<br>> sure that there is only one place where a declaration can be located<br>> in a module, regardless of the set of headers.<br>> <br></tt><br><tt>Thanks for the response Dmitri. Yes this is indeed the case. On my Ubuntu 15.10 system there are conditional typedefs of this flavor in 5 /usr/include/* header files for mode_t and in 6 header files for off_t.</tt><br><br><tt>What do you recommend I should try to work around the messy state of the system headers?</tt><br><br><tt>--dave</tt><br><BR>
</body></html>