zoukankan      html  css  js  c++  java
  • 【转】Visual Studio 2008中使用科学计算库GSL

    http://ixpress.spaces.live.com/blog/cns!8BCB40263F366272!683.entry

    1. 下载最新版GSL
    @ http://gnuwin32.sourceforge.net/packages/gsl.htm 最新的好像是1.9,不过这里只有1.8,估计1.9还在测试,不过无所谓。
    需要下载的是前两个文件:Complete package, except sources和Sources。然后安装。
     
    2. 配置VS和GSL
    在VS的菜单tools->options->project and solutions->VC++ directiories里面设置include,bin,lib,sources的文件夹,分别对应gsl的安装目录。include就到gsl的 include就行了,不要到include/gsl下面
    然后打开GSL的src文件夹,下面有个VC8文件夹,打开里面的libgsl.sln工程文件并编译(把四种库,debug release 静态 动态全编译了)。然后打开输出文件夹,把lib文件拷到gsl根目录的lib,把dll拷到system32
     
    3. 写程序
    工程向导win32 控制台程序。生成之后在工程配置里面找到C/C++ Generation下面的Runtime Libary,改成/MT或者/MTD。
    链接gsl的库有两种,静态的和动态的
    静态要加入libgsl.lib 和 libgslcblas.lib (release) 或者 libgsl_d.lib 和 libgslcblas_d.lib(debug)
    动态dll要加入libgsl_dll.lib 和 libgslcblas_dll.lib (release) 或者 libgsl_dll_d.lib 和 libgslcblas_dll_d.lib(debug),此外还要写上#define GSL_DLL
    加库可以这样
    #pragma comment(lib,"libgsl.lib")
    #pragma comment(lib, "libgslcblas.lib")
     
    4. 其他
    然后就欧了。不过在MFC里面好像编译不了静态链接模式的程序,应该是那个/MT冲突之类的,我不知道。实在不行用dll么。
    不过这个gsl就不能出个面向对象的么,看见指针数组就烦。

    另附英文介绍一篇:http://www.quantcode.com/modules/smartfaq/faq.php?faqid=33

    DOWNLOAD AND INSTALL GSL SOFTWARE

    1.Download gsl-1.8.exe from http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=19804
    (contains binaries and .lib files)
    2.Execute and finish the installation.

    3.Download gsl-1.8-src.exe from http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=19804
    4.Execute and finish the installation.

    INSTALL VISUAL C++ EXPRESS
    If you have not installed Visual C++ 2005 express, use this link :
    http://msdn.microsoft.com/vstudio/express/downloads/
    select visual C++ express

    BUILD GSL LIBRARIES FOR Visual studio
    1. Launch Visual C++ Studio
    2. Open project C:\Program Files\GnuWin32\src\gsl\1.8\gsl-1.8\VC8\libgsl.sln (assuming default path - replace if it is a different location)
    3. Do a build all
    4.Verify that after build is complete, new files are generated in subfolders in C:\Program Files\GnuWin32\src\gsl\1.8\gsl-1.8\VC8\libgsl

    CONFIGURE PATH SETTINGS IN VISUAL C++ STUDIO
    1.Launch Visual C++ studio
    2.Select Tools->Options Menu
    3.On the tree display in the Options dialog box, select branch for Projects and solutions->VC++ directories
    4.On the right side of the dialog, select Executable files in the "show directories for" combo box and add the following paths:
    C:\Program Files\GnuWin32\src\gsl\1.8\gsl-1.8\VC8\libgslcblas\Debug-DLL
    C:\Program Files\GnuWin32\src\gsl\1.8\gsl-1.8\VC8\libgsl\Debug-DLL

    5.In the "show directories for" combo box select "Include files" and add the following path:
    C:\Program Files\GnuWin32\include

    6.In the "show directories for" combo box select "Library files" and add the following paths:
    C:\Program Files\GnuWin32\src\gsl\1.8\gsl-1.8\VC8\libgsl\Debug-DLL
    C:\Program Files\GnuWin32\src\gsl\1.8\gsl-1.8\VC8\libgslcblas\Debug-DLL

    HOW DO I USE GSL LIBRARY IN MY VC++ PROJECT?
    1.Launch Visual studio
    2.Open your VC++ project.
    3.select menu Project -> properties
    4.In the property pages dialog, select tree item "configration properties->Linker->Input
    5.On the right hand side details, choose the field "Additional Dependencies" and append the following entries by clicking the ... button:
    libgsl_dll_d.lib
    libgslcblas_dll_d.lib
     
  • 相关阅读:
    C# 时间格式化
    新线程匿名方法的新用法
    响应类
    图灵API
    Xpath使用
    Meta http-equiv属性
    CAC的Debian-8-64bit安装BBR正确打开方式
    CAC的Debian-8-64bit安装BBR正确方式是?
    Mbps Mb M Kb如何换算
    如何解决服务器远程桌面连接成功但重启却操作失效?
  • 原文地址:https://www.cnblogs.com/fzzl/p/1811702.html
Copyright © 2011-2022 走看看