我使用在线安装程序安装了Qt5.4(在ubuntu 14上工作)。我试图编译我的c ++源代码并链接到libQt5Core但是ld会抛出错误:
make
g++ -Wall test.o Party.o Communication.o FileParser.o PeerConnection.o ServerModule.o Utilities.o -o party -g -L/home/bush/Qt/5.4/gcc_64/lib -L/usr/lib/x86_64-linux-gnu/ -lQt5Core -lboost_system -lpthread
/usr/bin/ld: warning: libicui18n.so.53, needed by /home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicuuc.so.53, needed by /home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_setMillis_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_fromUnicode_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_get_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_inDaylightTime_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_open_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_countAvailable_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_countAliases_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `u_errorName_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_openCountryTimeZones_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `u_strToUpper_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getDefaultName_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `uenum_next_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_strcoll_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getMaxCharSize_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getAvailableName_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_open_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_getTimeZoneDisplayName_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_toUnicode_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `uenum_close_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_getSortKey_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getAlias_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_close_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_setAttribute_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_close_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_openTimeZoneIDEnumeration_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_openTimeZones_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getStandardName_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_close_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_compareNames_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_clone_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `u_strToLower_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_getDefaultTimeZone_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_open_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_setSubstChars_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_getDSTSavings_53'
collect2: error: ld returned 1 exit status
make: *** [party] Error 1
我的makefile是:
CPPFLAGS=-g -c --std=c++0x -I/usr/include -I/home/bush/Qt/5.4/gcc_64/include -I/home/bush/Qt/5.4/gcc_64/include/QtCore -I/usr/include/boost
LDFLAGS=-g -L/home/bush/Qt/5.4/gcc_64/lib -L/usr/lib/x86_64-linux-gnu/ -lQt5Core -lboost_system -lpthread
all:party
party:test.o Party.o Communication.o FileParser.o PeerConnection.o ServerModule.o Utilities.o
g++ -Wall $^ -o party $(LDFLAGS)
test.o:test.cpp
g++ $(CPPFLAGS) test.cpp
Party.o:Party.cpp
g++ $(CPPFLAGS) Party.cpp
Communication.o:Communication.cpp
g++ $(CPPFLAGS) Communication.cpp
FileParser.o:FileParser.cpp
g++ -fPIC $(CPPFLAGS) FileParser.cpp
PeerConnection.o:PeerConnection.cpp
g++ $(CPPFLAGS) PeerConnection.cpp
ServerModule.o:ServerModule.cpp
g++ $(CPPFLAGS) ServerModule.cpp
Utilities.o:Utilities.cpp
g++ $(CPPFLAGS) Utilities.cpp
答案 0 :(得分:16)
我遇到了同样的问题。但我只是通过这段代码找到了出路。
export LD_LIBRARY_PATH=/usr/local/Qt/5.5/gcc_64/lib:$LD_LIBRARY_PATH
答案 1 :(得分:4)
在我的情况下,它在我制作了3个符号链接后起作用。安装了lib,但我的版本(55)比预期版本(54)更新。
sudo ln -s /usr/local/Qt/5.5/gcc_64/lib/libicui18n.so.54 /usr/lib/x86_64-linux-gnu/libicui18n.so.54
sudo ln -s /usr/local/Qt/5.5/gcc_64/lib/libicuuc.so.54 /usr/lib/x86_64-linux-gnu/libicuuc.so.54
sudo ln -s /usr/local/Qt/5.5/gcc_64/lib/libicudata.so.54 /usr/lib/x86_64-linux-gnu/libicudata.so.54
答案 2 :(得分:4)
当我尝试在QtCreator的Debian 8(来自官方存储库的libicu52)下构建我的项目时,我遇到了这样的错误。 我通过改变“环境”来解决这个问题。对于我的Qt Kit(5.8.0):LD_LIBRARY_PATH = / opt / Qt / 5.8 / gcc_64 / lib:$ {LD_LIBRARY_PATH}。
答案 3 :(得分:0)
当我尝试在Ubuntu下构建Iris时出现此错误。 我通过删除解决了它 CONFIG + =静态 来自.pro文件
答案 4 :(得分:-1)
尝试将-licuuc
添加到makefile的LDFLAGS中。
sudo apt-get install libicu-dev