boost

Get local date + time

Here I found this solution:

#pragma once
 
#include <boost/date_time/local_time/local_time.hpp>
#include <iostream>
#include <string>
 
 
static std::string date_and_time()
{	
  boost::local_time::time_zone_ptr tz(new boost::local_time::posix_time_zone("CET+1")); 
  boost::posix_time::ptime pt = boost::posix_time::second_clock::universal_time(); 
  boost::local_time::local_date_time dt(pt, tz); 
 
  std::stringstream ss;
  ss << dt.local_time() << std::endl;
 
  return ss.str();
}

Strange linker error

If you get this strange linker error

1>scene_understander.obj : error LNK2019: unresolved external symbol "private: static class std::codecvt<unsigned short,char,int> const * & __cdecl boost::filesystem3::path::wchar_t_codecvt_facet(void)" (?wchar_t_codecvt_facet@path@filesystem3@boost@@CAAEAPEBV?$codecvt@GDH@std@@XZ) referenced in function "public: static class std::codecvt<unsigned short,char,int> const & __cdecl boost::filesystem3::path::codecvt(void)" (?codecvt@path@filesystem3@boost@@SAAEBV?$codecvt@GDH@std@@XZ)
1>scene_understander.obj : error LNK2019: unresolved external symbol "void __cdecl boost::filesystem3::path_traits::convert(char const *,char const *,class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > &,class std::codecvt<unsigned short,char,int> const &)" (?convert@path_traits@filesystem3@boost@@YAXPEBD0AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEBV?$codecvt@GDH@5@@Z) referenced in function "void __cdecl boost::filesystem3::path_traits::dispatch<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > &,class std::codecvt<unsigned short,char,int> const &)" (??$dispatch@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@path_traits@filesystem3@boost@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@4@AEBV?$codecvt@GDH@4@@Z)
1>scene_understander.obj : error LNK2019: unresolved external symbol "void __cdecl boost::filesystem3::path_traits::convert(unsigned short const *,unsigned short const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::codecvt<unsigned short,char,int> const &)" (?convert@path_traits@filesystem3@boost@@YAXPEBG0AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$codecvt@GDH@5@@Z) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __cdecl boost::filesystem3::path::string(class std::codecvt<unsigned short,char,int> const &)const " (?string@path@filesystem3@boost@@QEBA?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$codecvt@GDH@5@@Z)
1>W:\src\Vca\x64\Release\\scene_understanding.dll : fatal error LNK1120: 3 unresolved externals

at least in my case I could resolve it with setting

Treat WChar_t As Built in Type from 'No' to 'Yes'

(project settings –> Configuration Properties –> C/C++ –> Language)

 
public/boost.txt · Last modified: 2013/02/09 19:21 (external edit) · []
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki