boostorg / boostorg/date_time

Compilation problems with greg_serialize.hpp

Open
#181 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
70
Forks
99
PR merge metrics
No merged PRs in 30d

Description

I noticed that the following code doesn't compile:
```
#include
#include

#include
#include

int main()
{
boost::gregorian::date d(2021, boost::date_time::Feb, 14);

std::ostringstream oss;
boost::archive::text_oarchive oa(oss);
oa & d;

std::cout << oss.str() << std::endl;
return 0;
}
```
it throws the following error:
```
boost/date_time/gregorian/greg_serialize.hpp:34:15: error: ‘split_free’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
```
And if we invert the order of the two boost inclusion headers (putting first `text_oarchive.hpp` and then `greg_serialize.hpp`) then it compiles but doesn't link:
```
main.cpp:(.text._ZN5boost13serialization4saveINS_7archive13text_oarchiveEEEvRT_RKNS_9gregorian4dateEj[_ZN5boost13serialization4saveINS_7archive13text_oarchiveEEEvRT_RKNS_9gregorian4dateEj]+0x36): undefined reference to `boost::gregorian::to_iso_string[abi:cxx11](boost::gregorian::date const&)'
```
In order to get it linked I added a new header: `#include `

So it seems that the header `boost/date_time/gregorian/greg_serialize.hpp` has missing dependencies, right? I didn't see any special consideration in the documentation of the library about using this header in a specific order.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.