Visual Stdio C++ 编译器 编译 (GSL) GNU Scientific Library 的方法介绍(7)

本文详细介绍使用VisualStudio C++编译器编译GNU Scientific Library (GSL)各个模块的过程,包括配置静态库项目文件、指定头文件路径及源文件等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

编译好的版本放到了这里,包括静态库和动态库。大家直接用吧。
http://download.youkuaiyun.com/detail/liyuanbhu/9618257

Visual Stdio C++ 编译器 编译 (GSL) GNU Scientific Library 的方法介绍(7)

gsl_dht 模块

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_dht
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/dht/dht.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_roots 模块

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_roots
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/roots/bisection.c \
    source/roots/brent.c \
    source/roots/convergence.c \
    source/roots/falsepos.c \
    source/roots/fdfsolver.c \
    source/roots/fsolver.c \
    source/roots/newton.c \
    source/roots/secant.c \
    source/roots/steffenson.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_min 模块

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_min
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/min/bracketing.c \
    source/min/brent.c \
    source/min/convergence.c \
    source/min/fsolver.c \
    source/min/golden.c \
    source/min/quad_golden.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_multiroots 模块

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_multiroots
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/multiroots/broyden.c \
    source/multiroots/convergence.c \
    source/multiroots/dnewton.c \
    source/multiroots/fdfsolver.c \
    source/multiroots/fdjac.c \
    source/multiroots/fsolver.c \
    source/multiroots/gnewton.c \
    source/multiroots/hybrid.c \
    source/multiroots/hybridj.c \
    source/multiroots/newton.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_multimin 模块

源代码中有一处 inline 需改为 __inline。
项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_multimin
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/multimin/conjugate_fr.c \
    source/multimin/conjugate_pr.c \
    source/multimin/convergence.c \
    source/multimin/diff.c \
    source/multimin/fdfminimizer.c \
    source/multimin/fminimizer.c \
    source/multimin/linear_minimize.c \
    source/multimin/simplex.c \
    source/multimin/simplex2.c \
    source/multimin/steepest_descent.c \
    source/multimin/vector_bfgs.c \
    source/multimin/vector_bfgs2.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_fit 模块

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_fit
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/fit/linear.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_multifit 模块

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_multifit
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/multifit/convergence.c \
    source/multifit/covar.c \
    source/multifit/fdfridge.c \
    source/multifit/fdfsolver.c \
    source/multifit/fdjac.c \
    source/multifit/fsolver.c \
    source/multifit/gradient.c \
    source/multifit/linear_common.c \
    source/multifit/lmder.c \
    source/multifit/lmniel.c \
    source/multifit/lmpar.c \
    source/multifit/multilinear.c \
    source/multifit/multireg.c \
    source/multifit/multirobust.c \
    source/multifit/multiwlinear.c \
    source/multifit/robust_wfun.c \
    source/multifit/work.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_multilarge 模块

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_multilarge
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/multilarge/multilarge.c \
    source/multilarge/normal.c \
    source/multilarge/tsqr.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_bspline 模块

两个文件中的 inline 需改为 __inline。

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_bspline
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/bspline/bspline.c \
    source/bspline/greville.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

物理常数

gsl 提供了许多物理常数的值。分别位于 gsl_const_cgs.h 、gsl_const_cgsm.h 、gsl_const_mks.h、 gsl_const_mksa.h 和 gsl_const_num.h 中,还有个 gsl_const.h 文件,包括了上面五个文件。我们只需将这六个文件从 const 目录拷贝到 include/gsl 目录中就可以了。

gsl_rstat 模块

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_rstat
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/rstat/rquantile.c \
    source/rstat/rstat.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_spblas 模块

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_spblas
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/spblas/spdgemm.c \
    source/spblas/spdgemv.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_spmatrix 模块

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_spmatrix
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/spmatrix/avl.c \
    source/spmatrix/spcompress.c \
    source/spmatrix/spcopy.c \
    source/spmatrix/spgetset.c \
    source/spmatrix/spmatrix.c \
    source/spmatrix/spoper.c \
    source/spmatrix/spprop.c \
    source/spmatrix/spswap.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_splinalg 模块

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_splinalg
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/splinalg/gmres.c \
    source/splinalg/itersolve.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_test 模块

这个模块在 gsl ref 中没有介绍,不过我们还是应该把它加进来。

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_test
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += source/test/results.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_diff 模块

diff 目录,数值差分功能,已经被 gsl_deriv 模块替代了。这里为了向前兼容,还是做了这个模块。

项目文件如下:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_diff
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES +=    source/diff/diff.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_utils 模块

utils 目录提供了一些辅助函数,这些函数都用不到。为了完整性,我们还是保留了这个模块。
项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_utils
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES += \
    source/utils/placeholder.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

gsl_version 模块

这个其实都不能算是一个模块,只是一个全局变量,存放了版本号。不过我实在是不知道该把它放到哪里,最后就把它单独拿出来做成一个模块了。

将 gsl_version.h 拷贝到 include 目录中。
将 gsl_version.c 拷贝到 source 目录中。

项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2016-08-26T20:38:46
#
#-------------------------------------------------

QT       -= core gui

TARGET = gsl_version
TEMPLATE = lib
CONFIG += staticlib

INCLUDEPATH += ./include/

SOURCES +=  source/version.c

unix {
    target.path = /usr/lib
    INSTALLS += target
}

DISTFILES +=

下篇博客介绍最后一个模块 gsl_ieee。这个模块里包含 ieee 浮点数精度设置等的内容。需要改动的地方比较多。所以准备单独拿出来说说。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值