C++ 从/到字符串的Boost日期转换错误 #包括 #包括 #包括“boost/date\u time.hpp” #包括“boost/date\u time/gregorian/gregorian.hpp” 使用名称空间std; 使用名称空间boost::gregorian; int main() { 字符串s(“2001-10-9”); 日期d=来自简单字符串; cout
编译时,添加标志C++ 从/到字符串的Boost日期转换错误 #包括 #包括 #包括“boost/date\u time.hpp” #包括“boost/date\u time/gregorian/gregorian.hpp” 使用名称空间std; 使用名称空间boost::gregorian; int main() { 字符串s(“2001-10-9”); 日期d=来自简单字符串; cout,c++,datetime,boost,C++,Datetime,Boost,编译时,添加标志-lboost\u date\u time以链接到boost日期时间库 在Netbeans中应该有一种正式的方法来添加库。找到它,然后添加boost\u date\u time以链接到您的可执行文件。如何使用Netbeans添加您的建议???@AnamulHasan我用谷歌搜索了它:非常感谢兄弟。它终于起作用了。 #include<iostream> #include<string> #include "boost/date_time.hpp
-lboost\u date\u time
以链接到boost日期时间库
在Netbeans中应该有一种正式的方法来添加库。找到它,然后添加
boost\u date\u time
以链接到您的可执行文件。如何使用Netbeans添加您的建议???@AnamulHasan我用谷歌搜索了它:非常感谢兄弟。它终于起作用了。
#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;
}