User forums > General (but related to Code::Blocks)

Third-party libraries: adding GSL to CODE::blocks

(1/3) > >>

humesit:
hello

i´m  a student and quite new to c++, but worked with other languages. i use winXP and codeblocks 8.02...
my problem is, that i want to use the gsl (GNU scientific libaryhttp://www.gnu.org/software/gsl/) in my program.

how do i install it? i read the advices for other third party libarys in the wiki. not enough explanation for me...:-(

i downloaded the compressed file, what next? i tried to include the .c files by myself but that didn´t work.
(like that:)

--- Code: ---
    #include <stdio.h>
     #include <gsl/specfunc/gsl_sf_bessel.h>  //i told the compiler to search for it, with "search directorys"

     int
     main (void)
     {
       double x = 5.0;
       double y = gsl_sf_bessel_J0 (x);
       printf ("J0(%g) = %.18e\n", x, y);
       return 0;
     }

error::
mingw32-g++.exe: no input files
--- End code ---



thanks for every help!


best
chris

Jenna:
If there are no prebuild libraries, you have to build them yourselves, and add the libraries in the "Linker settings" and the path, where they are installed in the linkers "Search directories".

How the libraries can be build should be explained in a "Readme"-file, or something similar (the exact way depends very much on the libs you want to use).
But your error message seems to be caused by something different, because missing libs normally cause an "undefined reference" error (this error might come up later).

Please turn on full commandline logging and post the appropriate part of the build log:

change "Settings -> Compiler and debugger... -> Global compiler settings -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline"

ASJ:
gsl is just a library you can link to. Just make sure your headers and libraries can be found. Judging on the error message, I get the impression that you just opened some .cpp file instead of creating a project and adding the code to that project.
Just create a new project, and copy the code in the the main.cpp file and try again....it should compile then

humesit:
well. you're both right. i just used a .cpp file instead of a project.

so far. but when i just link to the libary - there will be some trouble finding the next  #include(d) files he finds in the first .h file.

so i have to try this built thing.

INSTALL.dat:

--- Quote --- After unpacking the distribution
the Makefiles can be prepared using the configure command,

  ./configure

You can then build the library by typing,

  make

--- End quote ---

how can i use the command line of windows to built my libary?

thanks chris

[attachment deleted by admin]

ASJ:
if you're working on windows probably the easiest thing to get started is to use pre-compiled libraries.
If you are using the mingw compiler things just download the appropriate packages from gnuwin32 at sourceforge..
For the microsoft compilers I am not sure where to find pre compiled packages...

Navigation

[0] Message Index

[#] Next page

Go to full version