C++ 使用boost::gregorian::from_string()时发生链接器错误

C++ 使用boost::gregorian::from_string()时发生链接器错误,c++,boost,linker,visual-studio-2005,boost-date-time,C++,Boost,Linker,Visual Studio 2005,Boost Date Time,我在VisualStudio2005的1.48版中使用了boost。 我在尝试使用boost::gregorian::from_string()时收到链接器错误 #包括 #定义BOOST\u日期\u时间\u源 #包括 使用名称空间boost::gregorian; 使用名称空间std; void testDate(){ 字符串s(“2000-01-10”); 日期d2=从字符串开始; } int main() { testDate(); 返回0; } 并获取链接器错误: error LNK20

我在VisualStudio2005的1.48版中使用了boost。 我在尝试使用
boost::gregorian::from_string()
时收到链接器错误

#包括
#定义BOOST\u日期\u时间\u源
#包括
使用名称空间boost::gregorian;
使用名称空间std;
void testDate(){
字符串s(“2000-01-10”);
日期d2=从字符串开始;
}
int main()
{
testDate();
返回0;
}
并获取链接器错误:

error LNK2019: unresolved external symbol "public: static class boost::shared_ptr<class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned short,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,unsigned short> > > > __cdecl boost::gregorian::greg_month::get_month_map_ptr(void)" (?get_month_map_ptr@greg_month@gregorian@boost@@SA?AV?$shared_ptr@V?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@GU?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@G@std@@@2@@std@@@3@XZ) referenced in function "unsigned short __cdecl boost::date_time::month_str_to_ushort<class boost::gregorian::greg_month>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??$month_str_to_ushort@Vgreg_month@gregorian@boost@@@date_time@boost@@YAGABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
错误LNK2019:未解析的外部符号“public:静态类boost::shared\u ptr\u cdecl boost::gregorian::greg\u month::get\u month\u map\u ptr(void)”(?获取月地图)_ptr@greg_month@gregorian@boost@@SA?AV?$共享_ptr@V?$map@V?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@GU$less@V?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@G@std@@@2@@std@@@3@XZ)在函数中引用“未签名短cdecl boost::date\u time::month\u str\u to\u ushort(类std::basic\u string const&)”(?$month\u str\u to_ushort@Vgreg_month@gregorian@boost@@@日期_time@boost@@YAGABV?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@@std@@@Z)
为什么?

Boost.DateTime不适合您,因为您使用的是
from_string
;您需要先在项目中使用,然后在项目中使用。

日期时间库

boost\u date\u time-vc140-mt.lib

不在lib文件夹中。我已经用vcpakcgae管理器安装了它,它运行正常

error LNK2019: unresolved external symbol "public: static class boost::shared_ptr<class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned short,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,unsigned short> > > > __cdecl boost::gregorian::greg_month::get_month_map_ptr(void)" (?get_month_map_ptr@greg_month@gregorian@boost@@SA?AV?$shared_ptr@V?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@GU?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@G@std@@@2@@std@@@3@XZ) referenced in function "unsigned short __cdecl boost::date_time::month_str_to_ushort<class boost::gregorian::greg_month>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??$month_str_to_ushort@Vgreg_month@gregorian@boost@@@date_time@boost@@YAGABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)