Install and use GSL library

The packages for GSL can be found here
You can install just the library by using: apt-get install libgsl0ldbl

You can also install the development package and binary using: apt-get install gsl-bin libgsl0-dev

The resources/docs can also be installed using: apt-get install gsl-doc-info gsl-doc-pdf gsl-ref-html gsl-ref-psdoc

*depending on your setup you may need to use sudo before the apt-get command


Sample Codes Using GSL Routines

Directory Listings

C++ Programs

Compile and link C++ program program.cpp with: 
   g++ -Wall -c program.c
   g++ -o program program.o -lgsl -lgslcblas -lm

or all at once: 
   g++ -Wall -o program program.c -lgsl -lgslcblas -lm

filelast changed
qagiu_test.cpp12/28/2003
Monte_Carlo_test.cpp12/28/2003
qags_test.cpp01/19/2006
ode_test.cpp12/28/2003
simple_function.cpp01/03/2004
acceleration_test.cpp12/28/2003
J0_test.cpp12/28/2003
multifit_test.cpp12/28/2003

C Programs

Compile and link C program program.c with: 
   gcc -Wall -c program.c
   gcc -o program program.o -lgsl -lgslcblas -lm

or all at once: 
   gcc -Wall -o program program.c -lgsl -lgslcblas -lm

filelast changed
qagiu_test.c11/19/2002
acceleration_test.c09/27/2002
Monte_Carlo_test.c09/27/2002
J0_test.c09/27/2002
qags_test.c11/19/2002
multifit_test.c09/27/2002
ode_test.c11/14/2002


1 Linking programs with the library

The library is installed as a single file, libgsl.a. A shared version of the library libgsl.so is also installed on systems that support shared libraries. The default location of these files is /usr/local/lib. If this directory is not on the standard search path of your linker you will also need to provide its location as a command line flag.

To link against the library you need to specify both the main library and a supporting CBLAS library, which provides standard basic linear algebra subroutines. A suitable CBLAS implementation is provided in the library libgslcblas.a if your system does not provide one. The following example shows how to link an application with the library,

$ gcc -L/usr/local/lib example.o -lgsl -lgslcblas -lm

The default library path for gcc searches /usr/local/lib automatically so the -L option can be omitted when GSL is installed in its default location.

The option -lm links with the system math library. On some systems it is not needed.3

For a tutorial introduction to the GNU C Compiler and related programs, see An Introduction to GCC (ISBN 0954161793).4



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值