下面的代码给出了g ++ - 4.7.0的编译错误,但是用g ++ - 4.6编译得很好。boost :: date_time,g ++ - 4.7.0,编译错误
#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-日期time1.46.1。
有什么建议吗?
您是否在两种情况下都使用相同版本的boost? – juanchopanza 2012-04-29 07:11:02
是的。我没有看到我的机器上安装了任何其他版本的boost库。顺便说一句,这是一个编译错误的权利?图书馆的版本在这里很重要? – suresh 2012-04-29 07:17:38
这是一个编译错误。我不能重现它,但我的提升不是用C++ 11编译的。它看起来像你的(构造函数删除是c + + 11),所以我猜测boost是建立在最新的ubuntu上。你自己构建它,还是使用'get-apt install'? – juanchopanza 2012-04-29 07:22:32