簡體   English   中英

鏈接靜態庫的未解析符號

[英]Unresolved symbols linking static libraries

我通過靜態和動態庫的鏈接獲得了一些未定義的引用。

我的目標是獲取帶有靜態鏈接的poco和uiohook庫的可執行文件。 為了指定靜態鏈接,我提供了該庫的直接路徑,其中一些path/libName.apath/libName.a

以下命令:

/home/lrleon/LLVM-3.7/bin/clang -o collector -g -O2 -fno-strict-aliasing \
collector.o common-vars.o collector-events.o listeners.o \
active_window.o ../lib/libperfq-common.a \
/home/lrleon/aleph-w/libAleph.a /home/lrleon/poco/lib/libPocoNet.a \
/home/lrleon/poco/lib/libPocoFoundation.a /home/lrleon/uiohook/lib/libuiohook.a \
-lstdc++ -lX11 -lcairo -lgsl -lgslcblas -lpthread -lc 

給我以下錯誤:

/home/lrleon/poco/lib/libPocoFoundation.a(DateTime.o):DateTime.cpp:function Poco::DateTime::dayOfWeek() const: error: undefined reference to 'floor'
/home/lrleon/poco/lib/libPocoFoundation.a(DateTime.o):DateTime.cpp:function Poco::DateTime::toJulianDay(int, int, int, int, int, int, int, int): error: undefined reference to 'floor'
/home/lrleon/poco/lib/libPocoFoundation.a(DateTime.o):DateTime.cpp:function Poco::DateTime::toJulianDay(int, int, int, int, int, int, int, int): error: undefined reference to 'floor'
/home/lrleon/poco/lib/libPocoFoundation.a(DateTime.o):DateTime.cpp:function Poco::DateTime::toJulianDay(int, int, int, int, int, int, int, int): error: undefined reference to 'floor'
/home/lrleon/poco/lib/libPocoFoundation.a(NumericString.o):NumericString.cpp:function double_conversion::PowersOfTenCache::GetCachedPowerForBinaryExponentRange(int, int, double_conversion::DiyFp*, int*): error: undefined reference to 'ceil'
/home/lrleon/poco/lib/libPocoFoundation.a(NumericString.o):NumericString.cpp:function double_conversion::BignumDtoa(double, double_conversion::BignumDtoaMode, int, double_conversion::Vector<char>, int*, int*): error: undefined reference to 'ceil'
/home/lrleon/poco/lib/libPocoFoundation.a(NumericString.o):NumericString.cpp:function Poco::floatToStr(std::string&, float, int, int, char, char): error: undefined reference to 'floorf'
src/x11/input_hook.c:673: error: undefined reference to 'XRecordFreeData'
src/x11/input_hook.c:722: error: undefined reference to 'XRecordQueryVersion'
src/x11/input_hook.c:733: error: undefined reference to 'XRecordAllocRange'
src/x11/input_hook.c:745: error: undefined reference to 'XRecordCreateContext'
src/x11/input_hook.c:792: error: undefined reference to 'XRecordEnableContext'
src/x11/input_hook.c:812: error: undefined reference to 'XRecordFreeContext'
src/x11/input_hook.c:883: error: undefined reference to 'XRecordGetContext'
src/x11/input_hook.c:885: error: undefined reference to 'XRecordDisableContext'
src/x11/system_properties.c:134: error: undefined reference to 'XineramaIsActive'
src/x11/system_properties.c:136: error: undefined reference to 'XineramaQueryScreens'
src/x11/system_properties.c:396: error: undefined reference to 'XtGetMultiClickTime'
src/x11/system_properties.c:480: error: undefined reference to 'XtToolkitInitialize'
src/x11/system_properties.c:481: error: undefined reference to 'XtCreateApplicationContext'
src/x11/system_properties.c:485: error: undefined reference to 'XtOpenDisplay'
src/x11/system_properties.c:502: error: undefined reference to 'XtCloseDisplay'
src/x11/system_properties.c:503: error: undefined reference to 'XtDestroyApplicationContext'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我不明白為什么找不到一些符號。 例如,poco庫引用了ceilfloor ,但是這些符號屬於c標准庫。 據我了解,這些符號應該是可分解的,因為c庫僅在末尾鏈接。 那是在poco庫之后。 與對X11符號的引用類似,我相信它們會被libuiohook引用,並且隨后給出鏈接順序-lX11

關於我在做什么錯的任何想法嗎? 提前致謝

floor和ceil函數在Math庫中定義,我看不到使用-lm標志與libm鏈接

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM