本文介绍了链接错误:对icu_50 :: UnicodeString :: UnicodeString()的未定义引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译已声明为类成员的项目:

I am trying to compile my project where I've declared as class members some:

icu::UnicodeString label;
icu::UnicodeString tags;
icu::UnicodeString domain;
icu::UnicodeString data;

包含后(可以找到)

#include <unicode/unistr.h>

在我的CMakeLists.txt文件中,它搜索,查找并链接到:icuuc icudata(libicuuc,libicudata),如在抛出错误之前的输出所示:

In my CMakeLists.txt it searches, finds and links with: icuuc icudata (libicuuc, libicudata) as the output suggests prior to throwing the errors:

我已从源icu4c 50.1.2构建并安装,并将其安装在/usr/local/*下cmake可以正确找到库,因为我的错误来自链接阶段:

I have built and installed from source icu4c 50.1.2, and installed it under /usr/local/*cmake finds the libraries properly, as my errors are from the linking phase:

我正在使用gcc-4.7.2,并且在Debian Wheezy上启用了-std = c ++ 0x.昨晚在Debian Squeeze上使用完全相同的标志使用gcc-4.3.2编译了完全相同的代码!

I am using gcc-4.7.2 with -std=c++0x enabled on Debian Wheezy.The exact same code did compile with gcc-4.3.2 with the same flags on Debian Squeeze last night!

我无法为自己的一生,弄清楚我在做什么错!请帮忙!

I cannot for the life of me, figure out what I am doing wrong! Please help!

推荐答案

在构建ICU4C时,这似乎是我的错.我正在做一个简短的解释,因为我已经看到很多有关此问题的Google帖子,但没有答案.如果您在配置icu时仔细阅读了文档,则表明您应该做某些事情:

It appears this was my fault when building ICU4C.I am leaving a brief explanation as I have seen many google posts on this but no answers.If you read carefully the documentation when configuring icu, it states that you should do certain things:

1)使用命名空间定义为false:

1) Define using namespace to false:

 #   ifndef U_USING_ICU_NAMESPACE
-#       define U_USING_ICU_NAMESPACE 1
+        // Set to 0 to force namespace declarations in ICU usage.
+#       define U_USING_ICU_NAMESPACE 0

2)在linux上构建时,我去了一个非共享的静态库:

2) When building on linux, I went for a non-shared, static library:

runConfigureICU Linux --enable-static --disable-shared

3)这是导致我出错的重要部分:

3) This is the important part that caused my errors:

默认情况下,ICU库入口点名称具有ICU版本后缀.对于系统级安装,请关闭此功能,以在不中断应用程序的情况下升级ICU.例如:

runConfigureICU Linux --disable-renaming

必须安装此配置中的公共头文件,应用程序才能包含并获取正确的入口点名称.

我确实在Squeeze上执行了此操作,但没有在Wheezy上执行过此操作,因此导致了整个系统范围内安装的所有链接错误.吸取的教训,希望对其他人有帮助.

I did do that on Squeeze, but not on Wheezy, thus causing all the linkage errors on a system-wide installation.Lesson learned, hope it helps someone else.

这篇关于链接错误:对icu_50 :: UnicodeString :: UnicodeString()的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 04:05