我被这个难住了。
我有一些跨平台代码,我正在尝试用 Win7 x64 编译。该代码使用 Boost 1.54.0,特别是 boost::filesystem 库。
在尝试将字符串分配给 filesystem::path 时,除了少数函数调用之外,我的绝大多数代码都可以编译。
例如,如果我要做一些简单的事情:
string path = (char *)"/This/Is/A/Fake/Path";
filesystem::path boostpath = path;
我在链接阶段得到以下信息:
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)
我不知道是什么原因造成的。其他 boost 库(和文件系统调用)工作得很好!我能想到的唯一一件事就是宽字符和 Windows 发生了一些事情。搜索stackoverflow并没有找到我能找到的任何东西。链接错误本身似乎与字符串转换有关。
自然,这适用于 Linux/MacOSX。
提前致谢!
鲍勃