[Top][All Lists]

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

[Help-gsl] troubles in linking gsl from c++

From: bert
Subject: [Help-gsl] troubles in linking gsl from c++
Date: Wed, 1 Sep 2004 11:06:52 +0200
User-agent: Mutt/1.5.6i

Hi there,

I'm not able to link gsl from c++, here is my system:

    Gentoo GNU/Liux 2.4.22
    gsl 1.4
    gcc 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)

    source: gsl-helloworld.cpp

      #include <stdio.h>
      #include <gsl/gsl_sf_bessel.h>
      int main (void)
        double x = 5.0;
        double y = gsl_sf_bessel_J0 (x);
        printf ("J0(%g) = %.18e\n", x, y);
        return 0;

      g++ -c gsl-helloworld.cpp
                no problem: I get gsl-helloworld.o

      gcc gsl-helloworld.o -lgsl -lgslcblas -lm
                I get:
       gsl-helloworld.o(.eh_frame+0x11): undefined reference to 
       collect2: ld returned 1 exit status

        the same source with the file name changed into gsl-helloworld.c
        and compiled with gcc gives no problems.

What am I missing?

Alberto Bert
PhD student
University of Torino (Italy)

reply via email to

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