[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
因为我真的不知道为什么它们应该是必要的,所以我将它们从上面的输出中排除了。