When I am using Qt (v4.7.4) and Boost (tried v1.47 and v1.48) together in my c++ project, I get a linker error caused by a class that includes <boost\filesystem.hpp>
. I just set up Qt and before the code was working without any problems.
This is error message:
...obj : error LNK2001: unresolved external symbol "private: static class std::codecvt const * & __cdecl boost::filesystem3::path::wchar_t_codecvt_facet(void)" (?wchar_t_codecvt_facet@path@filesystem3@boost@@CAAAPBV?$codecvt@GDH@std@@XZ)
...obj : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem3::path_traits::convert(char const *,char const *,class std::basic_string,class std::allocator > &,class std::codecvt const &)" (?convert@path_traits@filesystem3@boost@@YAXPBD0AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@ABV?$codecvt@GDH@5@@Z)
...obj : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem3::path_traits::dispatch(class boost::filesystem3::directory_entry const &,class std::basic_string,class std::allocator > &,class std::codecvt const &)" (?dispatch@path_traits@filesystem3@boost@@YAXABVdirectory_entry@23@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@ABV?$codecvt@GDH@6@@Z)
...obj : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem3::path_traits::convert(unsigned short const *,unsigned short const *,class std::basic_string,class std::allocator > &,class std::codecvt const &)" (?convert@path_traits@filesystem3@boost@@YAXPBG0AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$codecvt@GDH@5@@Z)
...exe : fatal error LNK1120: 4 unresolved externals
EDIT:
Here I found someone having this problem coming to this conclusion:
this really is a Qt issue. Using wchar_t as a native type you have to recompile Qt using the same compiler switch. There even is a bug in the tracker: https://bugreports.qt.io/browse/QTBUG-9617
In general, you will have to be very careful and do not mix wchar_t compiler settings in your projects as they will become incompatible.
So I recompiled Qt setting /Zc:wchar_t
, but it didn't show any effect. I still get the same error.
b2.exe
if I remember correctly. – Pedrotreat wchar_t as build-in type
property when I was compiling boost. – Pedrocl ...
? It sounds to me like your/Zc:wchar_t
didn't take for some reason. Your compiler output would show that. – Dave Mateercl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -WX ... blah ... blah ... blah
– Dave Mateer