2015-10-21 36 views
0

我得到一些未定義的引用靜態和動態鏈接庫。未解決的符號鏈接靜態庫

我的目標是獲得與poco和uiohook庫靜態鏈接的可執行文件。爲了指定靜態鏈接,我提供了直接路徑到庫,有些爲path/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) 

我不明白,爲什麼都沒有發現一些符號。例如,ceil,0 floor被poco庫引用,但這些符號將屬於c標準庫。據我所知,這些符號應該是可以解決的,因爲c庫僅在最後連接;那是在poco庫之後。類似於X11符號的參考文獻,我相信這些參考文獻是用libuiohook引用的,鏈接順序-lX11在之後給出

任何關於我在做什麼錯誤的想法?在此先感謝

回答

2

地板和小區功能都在數學庫定義,我沒有看到你的libm鏈接使用-lm標誌

+0

這是正確的!謝謝! – lrleon