Gsl

  
is installed by non-root users under Linux.

GSL is a math library of GNU. It is free and powerful, and is very suitable for personal mathematics.

under linux is relatively simple to install gsl, there is no difference with the installation of other programs, as follows:

install GSL

The first step: Compile

After downloading and extracting, run the following command in the gsl root directory
./configure --prefix=YOUR_DIRECTORY

For example, I am used to installing in the opt directory, such as /home/user/opt/gsl1.16< Br>

Step 2: make

After the configuration is finished, run the make command, ie
make

Step 3: make install
make install

Step 4: Add environment variables

Use the vi editor to edit the configuration file in the user root directory.
vi ~/.bashrc

Add the following code to the end of the file:
#GSLexport PATH=$PATH:YOUR_DIRECTORY/binexport C_INCLUDE_PATH=$C_INCLUDE_PATH:YOUR_DIRECTORY/includeexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:YOUR_DIRECTORY/libexport GSL_LD =YOUR_DIRECTORY/lib

The last one is for convenience links.

Use GSL

to edit a test program as follows:
#include#include "gsl/gsl_math.h"int main(void){ double x=5.0; double y= gsl_sf_bessel_J0(x); printf("J0(%g)=%.18e\ ", x, y); return 0;}

Compile file:
gcc -o al.o -c test. c

link file:
gcc -o al.out al.o -lgsl -lgslcblas -L$GSL_LD -lm

or compile the link directly:
gcc -o al.out test.c - Lgsl -lgslcblas -L$GSL_LD -lm

Static link:
gcc -o al.out al.o -lgsl -lgslcblas -L$GSL_LD -static -lm

Copyright © Windows knowledge All Rights Reserved