2012-06-03 22 views
0
[1/2] g++ -std=gnu++11 -Wall -g -I/usr/local/include -c test.cpp -o test.o 
[2/2] g++ -std=gnu++11 -L/usr/local/lib64 -Wl,-rpath,/usr/local/lib64 -glog -lfolly test.o -o hello 
FAILED: g++ -std=gnu++11 -L/usr/local/lib64 -Wl,-rpath,/usr/local/lib64 -glog -lfolly test.o -o hello 
/usr/bin/ld: /usr/local/lib64/libfolly.so: undefined reference to symbol '_ZN6google15LogMessageFatalD1Ev' 
/usr/bin/ld: note: '_ZN6google15LogMessageFatalD1Ev' is defined in DSO /usr/local/lib64/libglog.so.0 so try adding it to the linker command line 
/usr/local/lib64/libglog.so.0: could not read symbols: Invalid operation 
collect2: error: ld returned 1 exit status 

libglog坐鎮內線/usr/local/lib64就像libfolly庫。出於某種原因,它在glog庫上「無法讀取符號」。爲什麼不?我已經嘗試添加所有這些沒有變化:-ldl -lc -lpthread -lrt 因爲我不知道爲什麼他們應該是必要的,我把它們從上面的輸出中排除。鏈接想,我已經聯繫

回答

0

您應該使用-lglog。由於共享對象庫名稱是libglog.so.0(檢查所有.so的存儲路徑)。