简体   繁体   English

Boost.Locale示例不在VS2010中运行

[英]Boost.Locale Examples doesn't runs in VS2010

I have been trying to learn Boost.Locale Module. 我一直在尝试学习Boost.Locale模块。 Consider this example. 考虑这个例子。 The code gets successfully compiled but when I try to run it, it gives the error 该代码已成功编译,但是当我尝试运行它时,它给出了错误

Unhandled exception at 0x74d34b32 in LearningCPP.exe: Microsoft C++ exception: std::bad_cast at memory location 0x00a6fa48..

I have attached the stack-trace of the program also. 我还附加了程序的堆栈跟踪。 Here it is: 这里是:

    KernelBase.dll!74d34b32()   
    [Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]    
    KernelBase.dll!74d34b32()   
>   msvcr100d.dll!_nh_malloc_dbg(unsigned int nSize, int nhFlag, int nBlockUse, const char * szFileName, int nLine)  Line 302 + 0x1d bytes  C++
    msvcr100d.dll!malloc(unsigned int nSize)  Line 56 + 0x15 bytes  C++
    LearningCPP.exe!std::use_facet<boost::locale::converter<char> >(const std::locale & _Loc)  Line 526 C++
    LearningCPP.exe!boost::locale::to_upper<char>(const char * str, const std::locale & loc)  Line 225 + 0x9 bytes  C++
    LearningCPP.exe!main()  Line 170 + 0xc4 bytes   C++
    LearningCPP.exe!__tmainCRTStartup()  Line 555 + 0x19 bytes  C
    LearningCPP.exe!mainCRTStartup()  Line 371  C
    kernel32.dll!75268543()     
    ntdll.dll!776bac69()    
    ntdll.dll!776bac3c()    

Did anyone faced this issue when using Boost.Locale in Visual Studio 2010 ? Visual Studio 2010使用Boost.Locale时,有人遇到过此问题吗? If so, how do I resolve this issue? 如果是这样,我该如何解决此问题?

PS: I have used option Use Unicode Character Set under the Character Set option of Visual Studio. PS:我在Visual Studio的“ Character Set选项下Use Unicode Character Set ”选项。 I believe the libraries are correctly linked too. 我相信这些库也已正确链接。

For others who may face the same issue, I found the solution. 对于其他可能遇到相同问题的人,我找到了解决方案。 The program still faced error in this example ran for calendar.cpp , collate.cpp and `conversions.cpp from this link . 示例中,该程序仍然通过该链接calendar.cppcollate.cpp和`conversions.cpp运行错误。

The solution was to add BOOST_ALL_DYN_LINK in preprocessor under Configuration Properties \\ C/C++ \\ Preprocessor . 解决方案是在“ Configuration Properties \\ C/C++ \\ Preprocessor下的预处理器中添加BOOST_ALL_DYN_LINK The program was able to run afterwards. 该程序随后可以运行。

PS: In linker I had added boost_locale-vc100-mt-gd-1_55.lib . PS:在链接器中,我添加了boost_locale-vc100-mt-gd-1_55.lib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM