标签:
1. 在gnu的ftp站点http://ftp.gnu.org/gnu/gsl/ 上, 下载最新的gsl-2.x.tar.gz
2. 解压下载好的gsl-2.x.tar.gz 压缩包,$tar -zxvf gsl-2.x.tar.gz. 这里我下载的是2.1版本, 直接解压在了Downloads文件夹中。
3. $ cd gsl-2.1, 进入到gsl文件夹中, 运行$./configure --prefix=/usr , 该命令指定之后安装的include, lib, bin等文件夹都安装在usr目录下,当然,这个安装路径可以由用户自己随意设置。
4. 相继运行,$make,$make check, $make install, gsl库便安装在了/usr 目录下。
configuration -- in the configuration step all parameters are set to control how to build and install the library.
build -- in the build step binaries are built from the source files.
installation -- the installation copies and rearranges all files that are necessary to build the library to a target directory.
5. 编译:假设我们有一个使用了gsl库的example.cpp 函数,则我们可以直接命令行编译: $g++ example .cpp -L /usr/lib/ -lgsl -lgslcblas -I /usr/include/ -o example.
也可以制作CMakeLists.txt文件,使用cmake进行编译。
至此,我们便可以得到二进制可执行文件。
标签:
原文地址:http://www.cnblogs.com/cbyzju/p/5351310.html