Boost C++ Libraries: Ticket #12040: The result of compilation relies upon the inclusion order of grep_serialize.hpp and gregorian.hpp https://svn.boost.org/trac10/ticket/12040 <p> The compilation success of a program should not rely upon the order in which a developer includes the headers. </p> <p> This is unfortunately the case when we want to serialize an object in which one of its member is a boost::gregorian::date. </p> <p> For the time being, a developer must include <strong>&lt;boost/date_time/gregorian/gregorian.hpp&gt;</strong> before <strong>&lt;boost/date_time/gregorian/grep_serialize.hpp&gt;</strong> otherwise the following error is thrown (with gcc, but it is reproduceable in clang): </p> <pre class="wiki">[18:34]stac@macdebian:~/development/cpp-sandbox/boost&gt;g++ --std=c++14 -g -I$HOME/development/date_time/include -lboost_serialization -lboost_date_time serialization.cpp In file included from serialization.cpp:6:0: /home/stac/development/date_time/include/boost/date_time/gregorian/greg_serialize.hpp: In function ‘void boost::serialization::save(Archive&amp;, const boost::gregorian::date&amp;, unsigned int)’: /home/stac/development/date_time/include/boost/date_time/gregorian/greg_serialize.hpp:59:35: error: there are no arguments to ‘to_iso_string’ that depend on a template parameter, so a declaration of ‘to_iso_string’ must be available [-fpermissive] std::string ds = to_iso_string(d); ^ /home/stac/development/date_time/include/boost/date_time/gregorian/greg_serialize.hpp:59:35: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) zsh: exit 1 g++ --std=c++14 -g -I$HOME/development/date_time/include -lboost_serializatio </pre><p> <strong>Current architecture</strong>: Linux macdebian 4.3.0-1-amd64 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1" title="#1: Bugs: boost.build causes ftjam to segfault (closed: Wont Fix)">#1</a> SMP Debian 4.3.5-1 (2016-02-06) x86_64 GNU/Linux </p> <p> <strong>Compilers</strong>: <em>gcc</em>: g++ (Debian 5.3.1-8) 5.3.1 20160205 </p> <p> <em>clang</em>: Debian clang version 3.6.2-3 (tags/RELEASE_362/final) (based on LLVM 3.6.2) Target: x86_64-pc-linux-gnu Thread model: posix </p> <p> A solution could be to forward declare the boost::gregorian::to_iso_string(const boost::gregorian::date&amp;) in greg_serialize.hpp. Or to include gregorian/formatters[_limited].hpp </p> <p> <strong>Remark</strong>: This problem does not occur with posix_time. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12040 Trac 1.4.3 laurent.stacul@… Thu, 03 Mar 2016 18:05:13 GMT attachment set https://svn.boost.org/trac10/ticket/12040 https://svn.boost.org/trac10/ticket/12040 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">serialization.cpp</span> </li> </ul> <p> Reproducer </p> Ticket