你好,游客 登录
背景:
阅读新闻

GSL库在VC6.0上的配置 - Augusdi的专栏

[日期:2013-04-15] 来源:  作者: [字体: ]

(转至http://blog.csdn.net/leowangzi/article/details/5357163)

这是我在VC6.0上配置Gsl的过程,希望对学习gsl的朋友有所帮助。

一、GSL介绍
GNU科学计算函数库GSL(GNU Scientific Library)是一个强大的C/C++数值计算函数库,它是一个自由软件,是GNU项目软件的一个部分,遵循GPL协议。GSL是一个为C和C++程序员提供的科学数值运算库。该科学计算库异常强大,函数库提供了大量的数值计算程序,如随机函数、特殊函数和拟合函数等等,整个函数库大约有1000多个函数,几乎涵盖了科学计算的各个方面。提供了如下方面的支持:
Complex Numbers Roots of Polynomials Special Functions
Vectors and Matrices Permutations Sorting
BLAS Support Linear Algebra Eigensystems
Fast Fourier Transforms Quadrature Random Numbers
Quasi-Random Sequences Random Distributions Statistics
Histograms N-Tuples Monte Carlo Integration
Simulated Annealing Differential Equations Interpolation
Numerical Differentiation Chebyshev Approximation Series Acceleration
Discrete Hankel Transforms Root-Finding Minimization
Least-Squares Fitting Physical Constants IEEE Floating-Point
Discrete Wavelet Transforms Basis splines

该函数库的主页是:http://www.gnu.org/software/gsl/gsl.html。

不过遗憾的是原始GSL并不支持不支持windows平台,可所幸的是有人做了GSL在windows上的移植工作,详见http://gnuwin32.sourceforge.net/packages/gsl.htm,目前版本是1.8。
二、下载gsl
1、从http://gnuwin32.sourceforge.net/packages/gsl.htm下载Complete package, except sources和Sources两个exe文件。
2、从http://www6.in.tum.de/~kiss/WinGsl.htm下载WinGsl-Lib-1.4.02.zip。
三、安装
1、 首先安装从http://gnuwin32.sourceforge.net/packages/gsl.htm下载的两个文件gsl-1.8.exe和gsl-1.8-src.exe。
2、 解压WinGsl-Lib-1.4.02.zip到D盘下,即D:/WinGsl。
四、设置Visual C++ 6.0编译环境
1、将D:/WinGsl/bin中的WinGsl.dll和WinGslD.dll复制到D:/VC6.0/Bin;将整个Gsl目录复制到D:/VC6.0/Bin下;lib目录下的所有.lib文件全部复制到D:/VC6.0/Lib下。
2、新建一个工程用于测试,我新建的是Test_gsl。然后在该项目的project-settings-link,在object/library modules中加入你用到的库文件,如WinGsl.lib等,加入多个可以用空格隔开。
3、 在tools-options-directories中,将D:/WinGsl下的lib,gsl分别加入到库文件和头文件的搜索路径中。
五、测试Gsl函数库
在工程Test_gsl中添加源文件test_gsl,其代码如下:
#include
#include
int main()
{
std::cout << gsl_sf_gamma_inc(1.5,0.5) << std::endl;
std::cout << gsl_sf_gamma_inc_Q( 1.5, 0.5 ) << std::endl;
std::cout << gsl_sf_gamma_inc_P( 1.5, 0.5 ) << std::endl;
return NULL;
}
结果运行的时候出现以下错误:
  LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
  Debug/Test_gsl.exe : fatal error LNK1120: 1 unresolved externals
然后我们将在project->settings->link->project options里,把project设置中的/subsysetm:Windows改为/subsystem:console,便可以编译并运行Test_gsl工程,说明Gsl函数库已经可以使用了。





收藏 推荐 打印 | 录入:admin | 阅读:
相关新闻