GSL configuration in Windows

Source: Internet
Author: User
Tags xform

1. Introduction to GSL

The GNU scientific computing function library GSL (GNU Scientific Library) is a powerful C/C ++ numeric computing function library. It is a free software and a part of the GNU project software, follow the GPL protocol. GSL is a scientific numerical computing library provided for C and C ++ programmers. The scientific computing library is exceptionally powerful, and the function library provides a large number of numerical computing programs.

 

Such as random functions, special functions, and fitting functions. There are more than 1000 functions in the function library, covering almost all aspects of scientific computing. Provides the following support:

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

 

The main page of this function library is http://www.gnu.org/software/gsl/gsl.html. Unfortunately, the original GSL does not support Windows platforms. Fortunately, some people have transplanted GSL on Windows. For details, see http://gnuwin32.sourceforge.net/packages/gsl.htm. the current issue is 1.8.

Ii. Download GSL

1. Download the complete package, Volume t sources, and sources files from http://gnuwin32.sourceforge.net/packages/gsl.htm.

 

Iii. Installation

1. First install.

 

4. Set the Visual C ++ 6.0 compiling environment

1. Generate the Lib file. The libgsl. lib and libgslcblas. Lib files are not found in the installation directory Lib, but there are two files with the extension def and A (File package format in Linux). Therefore, the files must be converted.

L start menu, click Run, And Enter cmd.

 

L enter the lib directory of The GSL library and enter the following two statements in sequence:
LIB/machine: i386/DEF: libgsl. Def
LIB/machine: i386/DEF: libgslcblas. Def

 

 

Look at the lib directory and find the libgsl. lib and libgslcblas. Lib files.

 

2. Set libgsl in X:/program files/gnuwin32l/bin. DLL and libgslcblas. DLL to X:/vc98/bin;/include the entire GSL directory to X:/vc98/include;/lib directory to all. copy all lib files to X:/vc98/lib.

3. Create a project for testing ,. Add the library file you used in the object/library modules in the project-settings-link, for example, libgsl. Lib libgslcblas. Lib, separated by spaces.

V. Test The GSL function library

# Define gsl_dll
# Include <GSL/gsl_spline.h>
# Include <cstdio>
# Include <cstdlib>
# Include <cmath>
# Include <Gl/glut. h>
# Include <Gl/Gl. h>
Void display ()
{
Glclear (gl_color_buffer_bit | gl_depth_buffer_bit );
Const size_t N = 4;
Double X [] = {0, 0.333336, 0.666666, 1 };
Double Y [] = {0, 0.5, 0.9, 0 };
Gsl_interp * interps [3] = {null, null, null };
Interps [0] = gsl_interp_alloc (gsl_interp_linear, N );
Interps [1] = gsl_interp_alloc (gsl_interp_polynomial, N );
Interps [2] = gsl_interp_alloc (gsl_interp_cspline, N );
Gsl_interp_init (interps [0], X, Y, N );
Gsl_interp_init (interps [1], X, Y, N );
Gsl_interp_init (interps [2], X, Y, N );
Gsl_interp_accel * ACC = gsl_interp_accel_alloc ();
Glbegin (gl_line_strip );
For (double T = 0.0; t <= 1.025; t + = 0.025)
{
Glcolor3f (1, 0, 0 );
Glvertex3f (T, gsl_interp_eval (interps [0], X, Y, T, ACC), 0.0 );
}
Glend ();
Glbegin (gl_line_strip );
For (double T = 0.0; t <= 1.025; t + = 0.025)
{
Glcolor3f (0, 0 );
Glvertex3f (T, gsl_interp_eval (interps [1], X, Y, T, ACC), 0.0 );
}
Glend ();
Glbegin (gl_line_strip );
For (double T = 0.0; t <= 1.025; t + = 0.025)
{
Glcolor3f (0, 0, 1 );
Glvertex3f (T, gsl_interp_eval (interps [2], X, Y, T, ACC), 0.0 );
}
Glend ();
Gsl_interp_accel_free (ACC );
Gsl_interp_free (interps [0]);
Gsl_interp_free (interps [1]);
Gsl_interp_free (interps [2]);
Gluswapbuffers ();
}
Int main (INT argc, char ** argv)
{
Gluinit (& argc, argv );
Fig );
Gluinitwindowsize (512,512 );
Glucreatewindow ("GSL interpolation ");
Gludisplayfunc (Display );
Glclearcolor (1, 1, 1 );
Glmatrixmode (gl_modelview );
Glloadidentity ();
Gltranslatef (-1,-1, 0 );
Glscalef (2, 2, 1 );
Glmatrixmode (gl_projection );
Glloadidentity ();
Glviewport (0, 0, 512,512 );
Gllinewidth (4.0 );
Glumainloop ();
Return 0;
} Running result:

 

 

This indicates that the GSL function library is ready for use.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/mooncircle/archive/2010/04/30/5545448.aspx

Use GNU Scientific Library (GSL) and GSL configurations

Baidu log 12:45:43 read 181 comment 1 font size:Medium and largeSmall

Author: Peng Jun

Email: hellotim # foxmail.com

Recently, I helped my friends compile a program with sift matching, but it not only used opencv but also gsl. However, during the compilation process, there was no problem with the configuration of opencv, but GSL never works. When using vc6.0 for compilation, there are always errors similar to the following:

XForm. OBJ: Error lnk2001: unresolved external symbol _ gsl_rng_free
XForm. OBJ: Error lnk2001: unresolved external symbol _ gsl_rng_set
XForm. OBJ: Error lnk2001: unresolved external symbol _ gsl_rng_alloc
XForm. OBJ: Error lnk2001: unresolved external symbol _ gsl_rng_mt19937
XForm. OBJ: Error lnk2001: unresolved external symbol _ gsl_sf_choose
XForm. OBJ: Error lnk2001: unresolved external symbol _ gsl_rng_uniform_int

Since it is a link error, it must be related to the Lib file. There is no file suffixed with LIB under the Lib folder of gsl. However, I can see files with the suffix def. I know that the DLL and Lib files can be exported through the def file. In addition, you can use the Lib command of vs on the network to export the. Lib file suitable for vs, So you can open the CMD window.

D:/program files/gnuwin32/lib> lib/machine: i386/DEF: libgsl. Def
Microsoft (r) Library Manager version 6.00.8168
Copyright (c) Microsoft Corp 1992-1998. All rights reserved.

Creating library libgsl. lib and object libgsl. Exp

D:/program files/gnuwin32/lib> lib/machine: i386/DEF: libgslcblas. Def
Microsoft (r) Library Manager version 6.00.8168
Copyright (c) Microsoft Corp 1992-1998. All rights reserved.

Creating library libgslcblas. lib and object libgslcblas. Exp

D:/program files/gnuwin32/lib>

We can see that libgsl. lib and libgslcblas. Lib are already in the Lib folder. We only need to add these two lib files to the link page of the project, as shown below:

Of course, to use GSL, you also need to add the include directory, lib directory, and bin directory of GSL to the VC directory, as shown below:

From the added include directory, we can see that when you use the header file in GSL, you need a reference similar to this:

# Include <GSL/gsl_rng.h>

Of course, if you add the include directory: D:/program files/gnuwin32/include/GSL

The preceding GSL is not required. You can reference it as long as it is: # include <gsl_rng.h>

Note that gsl_rng_free.h is not available in GSL, so you need to change it to gsl_rng.h.

You can download the VC program of the classic sift image matching program here:

Http://download.csdn.net/source/1352136

You can download GSL (GNU Scientific Library) 1.8 here:

Http://download.csdn.net/source/1352070

Http://blog.163.com/jinux@126/blog/static/12139366820096495233699/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.