0
當我鍵入make
我得到:libxcb.a:未定義參考符號 'XauGetBestAuthByAddr'
Linking CXX executable ../../bin/MyProgram
/usr/bin/ld: /home/myname/Desktop/MyProject/build/lib/libxcb.a(xcb_auth.o): undefined reference to symbol 'XauGetBestAuthByAddr'
/usr/lib/x86_64-linux-gnu/libXau.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
...
和我link.txt
文件看起來像
/usr/bin/g++ -O3 -O3 -DNDEBUG CMakeFiles/MyProject.dir/main.cpp.o
-o ../../bin/MyProject -L/home/myname/Desktop/MyProject/build/lib -rdynamic -lboost_thread-mt -lboost_date_time-mt -lboost_regex
-lboost_filesystem-mt -lboost_system-mt -lboost_program_options-mt ../../lib/libfftw3.a -lXau -lxcb -lXext -lX11 -lpetsc -lmpich -lmpl -lrt ../../lib/libflapack.a
-lgfortran ../../lib/libfblas.a -lgfortran ../../lib/libMyProjectAPI.a -lfftw3 -lGLU -lGL -lpthread ../../lib/libfftw3.a -lXau -lxcb -lX11 -lpetsc -lmpich -lmpl -lrt
../../lib/libflapack.a -lgfortran ../../lib/libfblas.a -lgfortran ../../lib/libfblas.a -lpthread -lboost_thread-mt -lboost_date_time-mt -lboost_regex
-lboost_filesystem-mt -lboost_system-mt -lboost_program_options-mt /home/myname/anaconda2/lib/libhdf5.so /home/myname/anaconda2/lib/libhdf5_hl.so
-lrt /home/myname/anaconda2/lib/libz.so -ldl -lm /home/myname/anaconda2/lib/libhdf5_cpp.so
/home/myname/anaconda2/lib/libhdf5_hl_cpp.so /home/myname/anaconda2/lib/libhdf5.so /home/myname/anaconda2/lib/libhdf5_hl.so -lrt /home/myname/anaconda2/lib/libz.so
-ldl -lm /home/myname/anaconda2/lib/libhdf5_cpp.so /home/myname/anaconda2/lib/libhdf5_hl_cpp.so -Wl,-rpath,/home/myname/Desktop/MyProject/build/lib:/home/myname/anaconda2/lib
有誰知道如何解決這個問題?我通過將相關的lib文件從/usr/lib/x86_64-linux-gnu
複製到home/myname/Desktop/MyProject/build/lib
解決了類似的錯誤。我想複製從以前-lXau
後者目錄會有所幫助,但顯然不是