Reputation: 127
I am stumped on this one.
I have some cross platform code that I am trying to compile with Win7 x64. The code uses Boost 1.54.0, specifically the boost::filesystem library.
The vast majority of my code compiles except for a few function calls when trying to assign strings to a filesystem::path.
For example, if I were to do something as simple as:
string path = (char *)"/This/Is/A/Fake/Path";
filesystem::path boostpath = path;
I get the following during the link stage:
LNK2001: unresolved external symbol "void __cdecl boost::filesystem::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@filesystem@boost@@$$FYAXPEBG0AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$codecvt@GDH@5@@Z)
I have no idea what is causing this. Other boost libraries, (and Filesystem calls) work just fine! The only thing that I can think of, is there is something going on with Wide Characters and Windows. Searching around stackoverflow hasn't turned up anything that I can find. The link error itself seems to related to string conversion.
Naturally, this works on Linux/MacOSX.
Thanks in advance!
bob.
Upvotes: 0
Views: 612
Reputation: 127
I finally got boost to work with the the the /Zc:wchar_t- switch. This involved editing the "msvc.jam" file. This file is located in your boost source folder.
The path is: your-boost-path/boost_1_54_0/tools/build/v2/tools/msvc.jam
I searched for wchar_t which turned up the /Zc:wchar_t flag. I altered the flag by changing it be /Zc:wchar_t-.
The updated line looks like this:
toolset.flags $(toolset).compile CFLAGS $(conditions) : /Zc:forScope /Zc:wchar_t- ;
I then compiled boost using the following command line. (I used these flags specifically for my needs.)
bjam --toolset=msvc-10.0 architecture=x86 threading=multi link=static address-model=64 --build-type=complete install --prefix=C:\local\boost
Once compiled, I gave my project a shot and it seems to work! I haven't done any serious testing yet, but it seems to compile.
Note: Switching the wchar_t flag resulted in a lot of compiler warnings, and a few failures. While I am not using every package that boost offers, I hope that the ones that I need are ok.
Bob..
Upvotes: 1