|
Boost Users : |
Subject: Re: [Boost-users] boost::filesystem with wstring
From: Paul (elegant_dice_at_[hidden])
Date: 2010-02-10 09:42:29
On 10 February 2010 16:03, <ariasgore_at_[hidden]> wrote:
> Hello,
> I am using Boost 1.41.0 with Visual Studio 2005 and noticed some strange
> behaviour which I am unsure how to fix.
>
When I call boost::filesystem::remove_all("somepath");
> everything compiles and links fine.
>
> But now a project works entirely on wstring basis so it happens that I pass
> something like
>
> boost::filesystem::remove_all(L"somepath");
>
> Code compiles still fine but it throws many linker errors like
>
> Fehler 2 error LNK2001: nresolved external symbol
> ""__declspec(dllimport) class boost::filesystem::file_status __cdecl
> boost::filesystem::detail::status_api(class std::basic_string<unsigned
> short,struct std::char_traits<unsigned short>,class std::allocator<unsigned
> short> > const &,class boost::system::error_code &)"
> (__imp_?status_api_at_detail@filesystem_at_boost@@YA?AVfile_status_at_23
> @ABV?$basic_string_at_GU?$char_traits_at_G@std@@V?$allocator_at_G@2@@std@
> @AAVerror_code_at_system@3@@Z)".
> Fehler 3 error LNK2001: nresolved external symbol
> ""__declspec(dllimport) public: static class std::basic_string<unsigned
> short,struct std::char_traits<unsigned short>,class std::allocator<unsigned
> short> > __cdecl boost::filesystem::wpath_traits::to_external(class
> boost::filesystem::basic_path<class std::basic_string<unsigned short,struct
> std::char_traits<unsigned short>,class std::allocator<unsigned short>
> >,struct boost::filesystem::wpath_traits> const &,class
> std::basic_string<unsigned short,struct std::char_traits<unsigned
> short>,class std::allocator<unsigned short> > const &)"
> (__imp_?to_external_at_wpath_traits_at_filesystem@boost@@SA?AV?$basic_string_at_GU
> ?$char_traits_at_G@std@@V?$allocator_at_G@2@@std@@ABV?$basic_path_at_V
> ?$basic_string_at_GU?$char_traits_at_G@std@@V?$allocator_at_G@2@@std@
> @Uwpath_traits_at_filesystem@boost@@@23_at_ABV45@@Z)".
>
>
>
I assume your boost library (filesystem) has been built with wstring/wpath
support... if so then the problem is likely that the boost library has been
built with wchar_t as a built-in type, and you are building your code with
wchar_t as an alias to "unsigned short"...
That is a Microsoft option, something like
/Zc:wchar_t-
So you have to figure out who is what, and ensure that both your code and
the libraries you link to are built the same.
It looks like your code wants to use unsigned-short as wchar_t, so I'd try
to *remove* the "/Zc:wchar_t-" option from your build options in your
project. Hopefully all the other 3rd party libraries you are linking to
also have the same option set.
see ya
Paul
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net