提升静态链接提升区域设置错误
boost static link boost.locale error
#include <boost/locale/encoding.hpp>
int main()
{
const std::string strutf8("你好,世界");
std::wstring wtrutf16 = boost::locale::conv::to_utf<wchar_t>(strutf8, "UTF-8");
return 0;
}
这是我的代码,我想在 CentOS 7 64 位系统上的项目中使用 boost.locale lib,我使用 ./bootstrap 和 ./b2 编译 boost 库,除了静态链接 libboost_locale.a,我在控制台中使用以下命令编译,我工作正常:
g++ -o locale locale.cpp -static -L ~/Downloads/boost_1_57_0/stage/lib -lboost_system -lboost_filesystem -lboost_locale
GCC 显示的错误如下所示:
/root/Downloads/boost_1_57_0/stage/lib/libboost_locale.a(codepage.o):in fuction ‘boost::locale::conv::impl::uconv_to_utf<wchar_t>::open(char const*, boost::locale::conv::method_type)’:
codepage.cpp:(.text._ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE[_ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE]+0xb0):undefined reference to ‘ucnv_open_50’未定义的引用
codepage.cpp:(.text._ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE[_ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE]+0xcd):undefined reference to ‘ucnv_close_50’未定义的引用
codepage.cpp:(.text._ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE[_ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE]+0x146):undefined reference to ‘UCNV_FROM_U_CALLBACK_STOP_50’
codepage.cpp:(.text._ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE[_ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE]+0x14e):undefined reference to ‘ucnv_setFromUCallBack_50’
codepage.cpp:(.text._ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE[_ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE]+0x16b):undefined reference to ‘UCNV_TO_U_CALLBACK_STOP_50’
codepage.cpp:(.text._ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE[_ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE]+0x17b):undefined reference to ‘ucnv_setToUCallBack_50’
codepage.cpp:(.text._ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE[_ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE]+0x18f):undefined reference to ‘ucnv_getMaxCharSize_50’
codepage.cpp:(.text._ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE[_ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE]+0x1a2):undefined reference to ‘ucnv_close_50’
....
我不知道发生了什么,我尝试安装 libiconv.a,但我没有工作。所以,Anynoe会告诉我如何解决这个问题吗?
"undefined reference"后面的符号名称属于 ICU4C。看起来您在编译加速区域设置时选择使用 ICU4C。
有两种解决方案:
- 添加链接ICU4C库的参数,请访问如何使用ICU了解更多详情。
- 重建 Boost Locale,设置 boost.locale.icu=off
相关文章:
- 如何解决gcc编译器优化导致的centos双编译器设置中的分段错误
- 设置 Visual Studio for MPI: 找不到标识符错误
- 变量被错误地设置为 204
- Cython 包含catkin_pkg设置的错误
- 设置我的应用程序 API 感知并防止系统使其模糊和错误定位
- error_code:如何设置和检查错误
- 使用pcl库设置错误
- 具有C++设置错误的用户对象
- C 98/C 03 STL设置错误
- 提升静态链接提升区域设置错误
- OSX 区域设置错误
- 如何设置错误处理语句的格式
- 当参数是目录时,ifstream open() 不会设置错误位
- STL映射,设置错误:内存超出分配块的末尾
- W10 + Clion,设置错误
- 使用 Boost JSON 解析器时出现 JSON 格式设置错误
- 使用OpenGL的Qt项目设置错误
- 测试设置错误:测试树为空
- 在链表中插入似乎将下一个指针设置错误
- 如何在MFC应用程序退出时设置错误级别