GSL 1.15 and 1.16 building with Visual Studio 2010 --FROM 4fire

http://4fire.wordpress.com/2012/03/18/gsl-1-15-building-with-visual-studio-2010/

Update 05/02/2014: A good book for GSL (updated with 1.16 version) is GNU Scientific Library Reference Manual – Third Edition.

Update 14-11-2013: Building GSL 1.16 with Visual Studio 2010 (VC++ 10): In July, GSL 1.16 was released, the source code files can be obtained fromthis. If one wants to build it with Visual Studio 2012 (VC++ 11), the VS solution file can be downloaded fromthis URL and the same steps (from 1 to 6) as doing with GSL 1.15 and VS 2010 are needed. Based onVC++ 11 solution files, I have created solution for some one who still works with Visual Studio 2010 (VC++ 10), and that file can be downloaded fromthis address.

Today I build GSL 1.15 for using with Visual Studio 2010. After downloading GSL 1.15 source code, I download VS 2010 solution files and start building GSL’s .dll and .lib for my own. And these are the steps:
1. Exatracting file gsl-1.15-vc10.zip into a folder (GSL_build for example). You should have the folder GSL_buildgsl-1.15-vc10after this step.
2. Exatracting file gsl-1.15.tar.gz into folderGSL_buildgsl-1.15.
3. Copy all gsl_*.h files from GSL_buildgsl-1.15 folder to GSL_buildgsl-1.15-vc10gsl folder (you should do a search here and make a copy on the found files).
4. Copy all files from folder GSL_buildgsl-1.15 to GSL_buildgsl-1.15-vc10 folder, do not overwrite the two filetemplates_on.h and env.c or you will encounter errors withRelease build.
5. Open file GSL_buildgsl-1.15-vc10build.vc10gsl.lib.sln with VS 2010 and startDebug andRelease build.
6. Open file GSL_buildgsl-1.15-vc10build.vc10gsl.dll.sln with VS 2010 and start Debug and Release build. You may need to copy cblas.lib file from folder build.vc10libWin32to folder build.vc10dllWin32 (Debug or Release sub folder) to make this step runs.
7. If you encounter errors (like me), then these are the fixings:
+ file bspline.c: moving variables declarations to the first part of the function:gsl_bspline_greville_abscissa(size_t i, gsl_bspline_workspace *w)
+ file rk4imp.c: replacing sqrt(3) with M_SQRT3.
It’s done now. You should have your .dll in gsl_buildgsl-1.15-vc10build.vc10dll and .lib in the foldergsl_buildgsl-1.15-vc10build.vc10lib.
8. Notes:
+ When copying these above files and folders, do not over write anyfiles.
+ You can build GSL with other blas library like Goto Blas, Atlas. Just replacing the cblas.lib with the suitable .lib file in buildinggsl.dll.
+ For using GSL, you need both .lib file in the gsl_buildgsl-1.15-vc10build.vc10lib folder and .dll file in thegsl_buildgsl-1.15-vc10build.vc10dll folder. Do not use .lib files fromgsl_buildgsl-1.15-vc10build.vc10dll folder.
+ You can use examples from Physics 780.20 Computational Physics course for testing your .dll and .lib files.
+ Another source you can use is located at: Data Analysis with Open source Tools. This is a good book with good examples.

+ Even though I did not test the above process of building GSL with other Visual Studio versions (VS Express, VS 2008, VS 2012) but I strongly believe that the same details can be applied.


!!! PS: add #define GSL_DLL at the beginning of the code.

!!! PPS: when using win32 application, 'include stdafx.h' should be placed ahead.

!!! PPPS: the binary and src exe files can be downloaded from: http://download.csdn.net/detail/aldenphy/7407527

原文地址:https://www.cnblogs.com/yfceshi/p/6822426.html