help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] linking libraries


From: Jordi Gutierrez Hermoso
Subject: Re: [Help-gsl] linking libraries
Date: Tue, 13 Mar 2007 10:29:00 -0600

On 13/03/07, cigdem ozkan <address@hidden> wrote:
To no avail.

What was to no avail?

So far nothing suggested has worked and I am at my wits end

Calm down. :-) This is a low-traffic mailing list. You may need to
wait 24 hours, 48 hours, even 72 sometimes to get a response.

Besides all the include statements - in each of the .h files - are in the
following form:
 #include <gsl/file.h>
where as under the gsl directory (where everything resides) different header
files are under different sub-directories (such as, 'gsl_matrix.h' is under
the directory 'matrix') but they still refer to eachother in the way I
mention above.

Right, right, but where is your include directory? Note that if you're
including files with #include <gsl/*>, then you must tell g++ to
include one directory *above* the gsl directory. E.g if the gsl header
files are under c:\Documents and Settings\cosmichee\gsl\ then you must
pass the line -IC:/Documents\ and\ Settings/cosmichee (I escaped the
spaces with backslashes and used forward slashes for path delimiters,
which should work if you're using Cygwin's bash shell, and I really
don't know how directory structure works under non-free operating
systems).

On other hand, you need to pass g++ a full linking path to the gsl
object library (usually named libgsl.so or something like that) with
the -LC:/path/to/shared/object/libraries.

Usually, however, both of these extra parameters to g++ are
unnecessary since g++ usually reads them from environment variables
and usually header files and library files get installed under
standard locations where g++ already knows how to find them. If you
compiled the GSL according to the INSTALL instructions, it should
already be in standard directories (alternatively, if you're willing
to try out an apt-based GNU/Linux distribution like Ubuntu or Debian,
you can save yourself the hassle of compilation and just aptitude
install the GSL library; apt can take care of the details of where to
install and makes sure that gcc already has the right environment
variables for linking and including).

Alternatively, try a compilation sanity check. Save

    #include <iostream>

    int main{
          using namespace std;
          cout << "Hello world!" << endl;
          return 0;
    }


as hello.cpp and compile with g++ hello.cpp -o hello. That should
compile and link without errors. Then try running it with ./hello .

Let me know how that goes. And take it easy. ;-)

- Jordi G. H.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]