This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Error Compiling a Simple GSL Program


banerjee@wernicke.ccn.upenn.edu writes:
 > Folks,
 >  I am trying to compile a simple GSL program, using cblas_ddot(), I
 > am having linking errors.
 >  Here's my compilation line:
 >  g++ gsl.cpp -I/usr/local/include -L/usr/local/lib -lgsl -lgslcblas
 > -lm
 >  Here's the error:
 >  /tmp/ccCPxtLp.o: In function `main': /tmp/ccCPxtLp.o(.text+0xb9):
 > undefined reference to `cblas_ddot(int, double const *, int, double
 > const *, int)' collect2: ld returned 1 exit status

Hi,

Thanks for the bug report.  I've looked at gsl_cblas.h and that
particular header file only defines the C linkage versions of the
functions (it was taken from the BLAS reference implementation).  As a
workaround you can access the functions from C++ using

  extern "C" {
  #include <gsl/gsl_cblas.h>
  }

I'll modify the header file to automatically detect when it's being
included in a C++ program like the other header files do.

In the function call you'll need to change sizeof(double) to 1, since
the stride is automatically counted in units of the underlying type.

regards
Brian Gough


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]