gsl_multimin.h
and
gsl_multiroots.h
located in your box?
Hint: gsl-config --cflags
.
blahblah : data log ; for f in $^; do echo -n $$f:; cat $$f; done data log : Makefile ; echo $@ > $@ clean : ; $(RM) data logWhat (and why) will it do and what (and why) will it build? Why double dollars in the first line? Why
echo -n
?
make main
and it fails with diagnostics
cc main.c -o main main.c:1:19: fatal error: gsl_sf.h: No such file or directory compilation terminated.Explain the error and how to correct it.
Hint: clang returns the following diagnostics,
clang main.c -o main main.c:1:9: fatal error: 'gsl_sf.h' file not found #include<gsl_sf.h> ^ 1 error generated.
make main
and it fails with diagnostics
cc main.c -o main /tmp/cce2r3LL.o: In function `main': main.c:(.text+0x1e): undefined reference to `gsl_sf_gamma' collect2: error: ld returned 1 exit statusExplain the error and how to correct it. Who is
ld
that returned exit status 1?
#include"stdio.h" #include"math.h" int main(){ double A=3.5, T=3.2, B=1.2; #define f(x) A*exp(-(x)/T)+B for(double t=0;t<=5;t+=1) printf("%g %g\n",t,f(t)); return 0; }
#include"stdio.h" #include"math.h" int main(){ double A=3.5, T=3.2, B=1.2; double f(double x){return A*exp(-x/T)+B;} for(double t=0;t<=5;t+=1) printf("%g %g\n",t,f(t)); return 0; }
#include"stdio.h" #include"math.h" #define f(x) A*exp(-(x)/T)+B int main(){ double A=3.5, T=3.2, B=1.2; for(double t=0;t<=5;t+=0.1) printf("%g %g\n",t,f(t)); return 0; }
#include"stdio.h" #include"math.h" double f(double x){return A*exp(-x/T)+B;} int main(){ double A=3.5, T=3.2, B=1.2; for(double t=0;t<=5;t+=1) printf("%g %g\n",t,f(t)); return 0; }
#include"stdio.h" void print_f_of_one( double (*f)(double) ){printf("%g\n",f(1.0));} int main(){ double f(double x){return x+x;} print_f_of_one(f); return 0; }
#include"stdio.h" void print_f_of_one( double (*f)(double) ){printf("%g\n",f(1.0));} int main(){ #define f(x) (x)+(x) print_f_of_one(f); return 0; }
echo 'gsl-config --libs'and
echo `gsl-config --libs`
echo
unix utility).