Ошибка `gregorian не была объявлена` в Boost C ++ 1.60 - PullRequest
0 голосов
/ 22 ноября 2018

Мой исходный код не скомпилирован с Boost C++ 1.60

$ g++ -c DateTimeUtil.cpp -I../../../boost_1.60.0/include/

In file included from ../../../boost_1.60.0/include/boost/date_time/local_time_adjustor.hpp:20:0,
                 from BoostDateTime.inl:6,
                 from DateTimeUtil.h:9,
                 from DateTimeUtil.cpp:1:
../../../boost_1.60.0/include/boost/date_time/dst_rules.hpp: In static member function ‘static boost::date_time::us_dst_rules<date_type_, time_duration_type_, dst_start_offset_minutes, dst_length_minutes>::date_type boost::date_time::us_dst_rules<date_type_, time_duration_type_, dst_start_offset_minutes, dst_length_minutes>::local_dst_start_day(boost::date_time::us_dst_rules<date_type_, time_duration_type_, dst_start_offset_minutes, dst_length_minutes>::year_type)’:
../../../boost_1.60.0/include/boost/date_time/dst_rules.hpp:317:45: error: ‘gregorian’ has not been declared
           nkday ssim(nkday::second, Sunday, gregorian::Mar);
                                             ^
../../../boost_1.60.0/include/boost/date_time/dst_rules.hpp:321:30: error: ‘gregorian’ has not been declared
           fkday fsia(Sunday, gregorian::Apr);
                              ^
../../../boost_1.60.0/include/boost/date_time/dst_rules.hpp: In static member function ‘static boost::date_time::us_dst_rules<date_type_, time_duration_type_, dst_start_offset_minutes, dst_length_minutes>::date_type boost::date_time::us_dst_rules<date_type_, time_duration_type_, dst_start_offset_minutes, dst_length_minutes>::local_dst_end_day(boost::date_time::us_dst_rules<date_type_, time_duration_type_, dst_start_offset_minutes, dst_length_minutes>::year_type)’:
../../../boost_1.60.0/include/boost/date_time/dst_rules.hpp:330:30: error: ‘gregorian’ has not been declared
           fkday fsin(Sunday, gregorian::Nov);
                              ^
../../../boost_1.60.0/include/boost/date_time/dst_rules.hpp:334:30: error: ‘gregorian’ has not been declared
           lkday lsio(Sunday, gregorian::Oct);
                              ^

Вот что я включил в свой исходный код:

#include <boost/date_time/c_local_time_adjustor.hpp>
#include <boost/date_time/local_time_adjustor.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>

Информация о системе:

$ uname -a
Linux duong2179-ubuntu 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ g++ --version
g++ (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4

1 Ответ

0 голосов
/ 22 ноября 2018

Просто включите этот заголовок первым:

#include <boost/date_time/gregorian/gregorian_types.hpp>
...