2014-10-03 60 views
0

我已經在Kubuntu 14.04中安裝了最新版本的GSL(1.16)。我使用庫安裝文件INSTALL(一步一步)。我配置eclipse-cdt環境來使用它。它工作,我認爲,因爲有一個自動完成,但是當我開始編譯程序時出現一些錯誤。請,我如何解決它?GSL編譯錯誤

對不起,我的英語不好! 文件math.c擁有的#include

Building target: C 
Invoking: GCC C Linker 
gcc -L/usr/local/lib -o "C" ./src/C.o -lgsl -lgslcblas 
/usr/local/lib/libgsl.a(math.o): In function `gsl_complex_polar': 
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:56: undefined reference to `sincos' 
/usr/local/lib/libgsl.a(math.o): In function `gsl_complex_logabs': 
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:115: undefined reference to `log' 
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:115: undefined reference to `log1p' 
/usr/local/lib/libgsl.a(math.o): In function `gsl_complex_abs': 
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:83: undefined reference to `hypot' 
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:83: undefined reference to `hypot' 
/usr/local/lib/libgsl.a(math.o): In function `gsl_complex_sqrt': 
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:293: undefined reference to `sqrt' 
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:293: undefined reference to `sqrt' 
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:288: undefined reference to `sqrt' 
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:288: undefined reference to `sqrt' 
/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:293: undefined reference to `sqrt' 
...... 
collect2: error: ld returned 1 exit status 
make: *** [C] Error 1 

回答

1

這很可能只是一個缺失的環節,以數學庫。您可能需要嘗試將-lm添加到-lgsl -lgslcblas之後的鏈接命令中。