C++ windows上boost::locale异常

C++ windows上boost::locale异常,c++,boost,C++,Boost,我尝试使用boost::locale来标记字符串。 我在64位windows 8上运行它。我使用VS2015来构建我的项目。 Boost版本1.63 我使用示例文件-boundary.cpp中的代码: generator gen; locale loc = gen(""); locale::global(loc); wcout.imbue(loc); std::ios_base::sync_with_stdio(false); std::string text("Hello World!Linu

我尝试使用boost::locale来标记字符串。 我在64位windows 8上运行它。我使用VS2015来构建我的项目。 Boost版本1.63 我使用示例文件-boundary.cpp中的代码:

generator gen;
locale loc = gen("");
locale::global(loc);
wcout.imbue(loc);
std::ios_base::sync_with_stdio(false);
std::string text("Hello World!Linux2.6 and Windows7 is word and number!");
boundary::ssegment_index index(boundary::word, text.begin(), text.end());
最后一行抛出异常:

引发异常:读取访问冲突。 std::use_facet>(…)返回null ptr


当然,您可以提供一个可编译的示例?请参见以下内容:#include“stdafx.h”#include#include#include使用名称空间boost::locale;使用名称空间std;int main(){generator gen;locale loc=gen(“”);locale::global(loc);wcout.imbue(loc);std::ios_base::sync_with_stdio(false);std::string text(“Hello World!Linux2.6和Windows7是单词和数字!”);boundary::ssegment_索引(boundary::word,text.begin(),text.end());return 0;}我在VC2015中编译了它。边界::段索引索引(边界::word,text.begin(),text.end());-抛出异常:在BooStLoLal.EXE中的0x000 DFF781BF8B9C抛出异常:微软C++异常:STD::BADYCAST在内存位置0x00 000 DDD42C1EB58。我发现了问题-似乎问题是我与Boost静态链接。在我使用boost切换到动态链接后,它就可以工作了。当然你可以提供一个可编译的示例吗?请参见下面的:#include“stdafx.h”#include#include#include使用名称空间boost::locale;使用名称空间std;int main(){generator gen;locale loc=gen(“”);locale::global(loc);wcout.imbue(loc);std::ios_base::sync_with_stdio(false);std::string text(“Hello World!Linux2.6和Windows7是单词和数字!”);boundary::ssegment_索引(boundary::word,text.begin(),text.end());return 0;}我在VC2015中编译了它。边界::段索引索引(边界::word,text.begin(),text.end());-抛出异常:在BooStLoLal.EXE中的0x000 DFF781BF8B9C抛出异常:微软C++异常:STD::BADYCAST在内存位置0x00 000 DDD42C1EB58。我发现了问题-似乎问题是我与Boost静态链接。在我用boost切换到动态链接后,它就工作了。