今天在ubuntu系統下進行程序調試的時候出現以下錯誤信息:
[ 10%] Linking CXX executable ../test_coco /usr/local/lib/libgsl.so: undefined reference to `cblas_ztrsv' /usr/local/lib/libgsl.so: undefined reference to `cblas_scasum' /usr/local/lib/libgsl.so: undefined reference to `cblas_izamax' /usr/local/lib/libgsl.so: undefined reference to `cblas_dnrm2' /usr/local/lib/libgsl.so: undefined reference to `cblas_zdotc_sub' collect2: error: ld returned 1 exit status make[2]: *** [test_coco] Error 1 make[1]: *** [src/CMakeFiles/test_coco.dir/all] Error 2 make: *** [all] Error 2
可以看出,之前的編譯都沒有問題,在最后的鏈接階段出現錯誤,根據提示可知,libgsl庫鏈接相關文件的時候出現問題。libgsl庫依賴clbas庫中的相關文件。所以在鏈接gls后還需加上對gslcblas的鏈接,問題解決!