如何安装C/C++ GNU Scientific Library(GSL) for Windows

来源:互联网 发布:linux 编译python模块 编辑:程序博客网 时间:2024/05/21 06:57

本文引自:http://blog.chinson.idv.tw/2006/08/cc-gnu-scientific-librarygsl-for.html

因为国内打不开原文网页,特转录至此,方便学习。

C/C++ GNU Scientific Library(GSL) for Windows

The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. It is freesoftware under the GNU General Public License.

The library provides a wide range of mathematical routines such as randomnumber generators, special functions and least-squares fitting. There are over1000 functions in total with an extensive test suite.

GNU Scientific Library (GSL) 是一个内含许多数值及科学运算函式的 C/C++函式库,内含超过 1000个以上的函式(例如︰数值微分小波转换排序..等等),并且可以使用在各种操作系统平台。
 GSLWindows开发环境下的使用 中有简单说明如何在 Windows环境使用 GSL,以下则是再详细一点介绍如何在 Visual C++ 6.0 IDE (整合型窗口接口)下使用︰

1.
首先到 http://gnuwin32.sourceforge.net/packages/gsl.htm 下载 BinariesDeveloper files 
2.
 Binaries packagebin子目录下的 libgsl.dll, libgslcblas.dll两个档案复制到 C:\Windows\System32中。
3.
 Developer files 解压缩后,在 VC IDE 中设定 include, lib 子目录的路径。
4.
由于此版本的 lib子目录中不含 .lib文件,必须用以下指令产生。请先开启 DOS模式窗口(附属应用程序/命令提式字符),切换目录到 lib 目录下,并下达︰

lib /machine:i386 /def:libgsl.def
lib /machine:i386 /def:libgslcblas.def

可产生 libgsl.lib, libgslcblas.lib两个档案。
5.
VC 项目中加入 libgsl.lib, libgslcblas.lib  2 lib link 参数中。
6.
VC 项目的 Preprocessor definitions 中加入 GSL_DLL

(5步中>工程>setting->/link)

(6步中>工程>setting->C/C++->Preprocessordefinitions)


7. 可用函式及说明请见 Reference Manual 

ps. GSL
是使用C语法写成,故并没有使用类别(class),而是以结构(struct)及函式(function)组成,不过 GSL 仍可以用在 C++编绎器,并与 C++程序兼容。



原创粉丝点击