boost::gregorian::date myDate ( boost::gregorian::day_clock::local_day());
std::string today = boost::gregorian::to_iso_string(myDate);
第一句,date前要加命名空间;
第二句,报错:
/tmp/ccaSDZPD.o: In function `boost::date_time::month_formatter<boost::gregorian::greg_month, boost::date_time::iso_format<char>, char>::format_month(boost::gregorian::greg_month const&, std::ostream&)':
type_cast_test.cpp:(.text._ZN5boost9date_time15month_formatterINS_9gregorian10greg_monthENS0_10iso_formatIcEEcE12format_monthERKS3_RSo[_ZN5boost9date_time15month_formatterINS_9gregorian10greg_monthENS0_10iso_formatIcEEcE12format_monthERKS3_RSo]+0x33): undefined reference to `boost::gregorian::greg_month::as_short_string() const'
type_cast_test.cpp:(.text._Z