Hi, seems you're missing the math library. The link command should be:
gcc -L/usr/local/lib -o "C" ./src/C.o -lm -lgsl -lgslcblas So include the '-lm' switch. Matthias On 10/03/2014 01:57 PM, Jorge B. Pineiro Cruz wrote: > When I install the library and configure the eclipse-cdt for use it, I > got an error when compile the file.c of my project. How I can solve it? > > Sorry, for my bad english > > 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' > /usr/local/lib/libgsl.a(math.o):/home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:319: > more undefined references to `sqrt' follow > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_exp': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:332: undefined > reference to `exp' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:332: undefined > reference to `sincos' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_pow': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:371: undefined > reference to `exp' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:372: undefined > reference to `sincos' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arg': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:77: undefined > reference to `atan2' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:77: undefined > reference to `atan2' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_pow_real': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:400: undefined > reference to `exp' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:401: undefined > reference to `sincos' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arg': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:77: undefined > reference to `atan2' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_sin': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:446: undefined > reference to `sin' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:454: undefined > reference to `sincos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:450: undefined > reference to `cosh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:450: undefined > reference to `sinh' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_cos': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:467: undefined > reference to `cos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:475: undefined > reference to `sincos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:471: undefined > reference to `cosh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:471: undefined > reference to `sinh' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_tan': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:492: undefined > reference to `exp' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:494: undefined > reference to `cos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:497: undefined > reference to `tanh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:499: undefined > reference to `sin' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:486: undefined > reference to `cos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:486: undefined > reference to `sinh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:488: undefined > reference to `sin' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:488: undefined > reference to `sinh' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arcsin_real': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:615: undefined > reference to `acosh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:611: undefined > reference to `acosh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:605: undefined > reference to `asin' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arcsin': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:544: undefined > reference to `hypot' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:544: undefined > reference to `hypot' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:568: undefined > reference to `atan' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:585: undefined > reference to `log1p' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:555: undefined > reference to `asin' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:589: undefined > reference to `log' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:562: undefined > reference to `atan' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:585: undefined > reference to `sqrt' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:589: undefined > reference to `sqrt' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:568: undefined > reference to `sqrt' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:562: undefined > reference to `sqrt' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arccos_real': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:706: undefined > reference to `acosh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:702: undefined > reference to `acosh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:696: undefined > reference to `acos' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arccos': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:635: undefined > reference to `hypot' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:635: undefined > reference to `hypot' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:659: undefined > reference to `atan' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:676: undefined > reference to `log1p' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:646: undefined > reference to `acos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:680: undefined > reference to `log' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:653: undefined > reference to `atan' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:676: undefined > reference to `sqrt' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:680: undefined > reference to `sqrt' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:659: undefined > reference to `sqrt' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:653: undefined > reference to `sqrt' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arctan': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:721: undefined > reference to `atan' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:729: undefined > reference to `hypot' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:744: undefined > reference to `hypot' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:745: undefined > reference to `hypot' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:746: undefined > reference to `log' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:740: undefined > reference to `log1p' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:740: undefined > reference to `log1p' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:766: undefined > reference to `atan2' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arcsec_real': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:787: undefined > reference to `acos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:793: undefined > reference to `acosh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:797: undefined > reference to `acosh' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arccsc_real': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:818: undefined > reference to `asin' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:824: undefined > reference to `acosh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:828: undefined > reference to `acosh' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_sinh': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:859: undefined > reference to `sincos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:863: undefined > reference to `sinh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:863: undefined > reference to `cosh' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_cosh': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:869: undefined > reference to `sincos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:873: undefined > reference to `cosh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:873: undefined > reference to `sinh' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_tanh': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:892: undefined > reference to `cos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:892: undefined > reference to `sinh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:893: undefined > reference to `sinh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:895: undefined > reference to `tanh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:895: undefined > reference to `sin' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:886: undefined > reference to `cos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:886: undefined > reference to `sinh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:888: undefined > reference to `sinh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:888: undefined > reference to `cosh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:888: undefined > reference to `sin' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arccosh_real': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:956: undefined > reference to `acos' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:960: undefined > reference to `acosh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:950: undefined > reference to `acosh' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arctanh_real': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:994: undefined > reference to `atanh' > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:990: undefined > reference to `atanh' > /usr/local/lib/libgsl.a(math.o): In function `gsl_complex_arg': > /home/hacker101/Project/Libraries/gsl-1.16/complex/math.c:77: undefined > reference to `atan2' > /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' > collect2: error: ld returned 1 exit status > make: *** [C] Error 1 > III Escuela Internacional de Invierno en la UCI del 17 al 28 de febrero > del 2014. Ver www.uci.cu > -- Dr. Matthias Sitte Email: [email protected] 1003 Justin Lane [email protected] Apt. 1037 [email protected] Austin, TX 78757-2644 UNITED STATES OF AMERICA
