Boost date conversion error from/to string
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#include<iostream>
#include<string> #include"boost/date_time.hpp" using namespace std; using namespace boost::gregorian; int main() { string s("2001-10-9"); date d=from_simple_string(s); cout << to_simple_string(d) << endl; return 0; } |
这段代码给出了三个错误
/usr/include/boost/date_time/date_formatting.hpp:44: undefined reference to `boost::gregorian::greg_month::as_short_string() const’
/usr/include/boost/date_time/date_formatting.hpp:49: undefined reference to `boost::gregorian::greg_month::as_long_string() const’
/usr/include/boost/date_time/date_parsing.hpp:67: undefined reference to `boost::gregorian::greg_month::get_month_map_ptrabi:cxx11′
我正在使用 netbeans,ubuntu 16.04,boost 1.58.0,g 5.4
这些错误究竟是什么意思,我该如何解决?
编译时,添加标志
Netbeans 中应该有一种正式的方式来添加库。找到它,然后添加
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/268886.html