6

以下代码使用 g++-4.7.0 时会出现编译错误,但使用 g++-4.6 时可以正常编译。

#include <iostream>
#include <boost/date_time/local_time/local_time.hpp>
using namespace std;
int main(){
    boost::posix_time::ptime time_t_epoch(boost::gregorian::date(1970,1,1));
    cout << time_t_epoch << endl;
    return 0;
}

以下是反复看到的错误信息(编译器输出很多信息)

/usr/include/boost/date_time/local_time/local_date_time.hpp:433:84: error: use of deleted function boost::shared_ptr<boost::date_time::time_zone_base<boost::posix_time::ptime, char> >::shared_ptr(const boost::shared_ptr<boost::date_time::time_zone_base<boost::posix_time::ptime, char> >&)

我正在使用 Ubuntu 12.04 和 libboost-date-time1.46.1。

有什么建议么?

4

1 回答 1

6

通过安装 boost-1.48 解决了问题

于 2012-04-29T09:25:59.543 回答