Using boost::filesystem

Hi,
I am trying to use boost::filesystem libraries for operations like copy directory, copy file, etc.
However I am getting linker errors as soon as I make a variable of the object path -
boost::filesystem::path p1{ "C:\\" };

Linker error -
error LNK2019: unresolved external symbol "void __cdecl boost::filesystem::path_traits::convert(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (?convert@path_traits@filesystem@boost@@YAXPEBD0AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) referenced in function "void __cdecl boost::filesystem::path_traits::dispatch<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &)" (??$dispatch@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@path_traits@filesystem@boost@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@4@@Z)

I am unable to interpret and resolve this issue.
Looking for some guidance.
All examples show this approach of using filesystem. But somehow it is not working for me.

Thanks in Advance
Are you linking to the library?
Yes I have used the reference of boost_1_64_0 for linking
You are not linking your application correctly.
Last edited on
What are the other things that need to be handled?
Since the Microsoft implementation is being used, there is no need to use boost::filesystem
It has built in support for the Filesystem TS std::experimental::filesystem
http://en.cppreference.com/w/cpp/experimental/fs

For a code example, see: http://rextester.com/XVBO74296
Do other parts of boost work?

Maybe this helps?
https://stackoverflow.com/questions/21056386/linker-errors-when-using-boostfilesystem
Always good to try googling the error messages, if you haven't.
Registered users can post here. Sign in or register to post.