
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@detail@filesystem@boost@@YA?AVfile_status@23@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAVerror_code@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@wpath_traits@filesystem@boost@@SA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@ABV?$basic_path@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@Uwpath_traits@filesystem@boost@@@23@ABV45@@Z)". So what happens here? I searched boost for some wstring support or similar but had no luck. It is quite unhandy to transform to and from wstring<>string. Thanks Sam -- NEU: Mit GMX DSL über 1000,- ¿ sparen! http://portal.gmx.net/de/go/dsl02

On 10 February 2010 16:03, <ariasgore@gmx.de> 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@detail@filesystem@boost@@YA?AVfile_status@23 @ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@ @AAVerror_code@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@wpath_traits@filesystem@boost@@SA?AV?$basic_string@GU ?$char_traits@G@std@@V?$allocator@G@2@@std@@ABV?$basic_path@V ?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@ @Uwpath_traits@filesystem@boost@@@23@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
participants (2)
-
ariasgore@gmx.de
-
Paul