c - Undefined references in GSL -


i'm trying link gsl in small c program.

#include "stdlib.h" #include "stdio.h" #include "gsl/gsl_block_float.h" #include "gsl/gsl_matrix_float.h"  int main(void) {   gsl_matrix_float* m = gsl_matrix_float_alloc(2, 2);   gsl_matrix_float_fprintf(stdout, m, "%f"); } 

i'm compiling gcc -lgsl -lgslcblas -lm program.c. i've tried gcc $(pkg-config --cflags gsl) $(pkg-config --libs gsl) program.c well, along gsl-config. in every case, gcc returns

/tmp/cc1wkgxm.o: in function `main': program.c:(.text+0x13): undefined reference `gsl_matrix_float_alloc' program.c:(.text+0x32): undefined reference `gsl_matrix_float_fprintf' collect2: error: ld returned 1 exit status 

objdump --syms /usr/lib/libgsl.so | grep gsl_matrix_float returns proper symbols, grepping headers. in /usr/lib or /usr/include doing wrong?

i got ubuntu forums. order of arguments togcc might issue

gcc -o program program.c `gsl-config --cflags --libs` 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -