关于 c :Boost 日期从/到字符串的转换错误 | 珊瑚贝

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”
#include”boost/date_time/gregorian/gregorian.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

这些错误究竟是什么意思,我该如何解决?


编译时,添加标志 -lboost_date_time 以链接到 boost 日期时间库。

Netbeans 中应该有一种正式的方式来添加库。找到它,然后添加 boost_date_time 以链接到您的可执行文件。

  • 如何用 netbeans 添加你的建议???
  • @AnamulHasan 我为您搜索了它:stackoverflow.com/questions/15040303/…
  • 非常感谢兄弟。它终于起作用了。


来源:https://www.codenong.com/49510164/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_10039.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?