This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: Error Compiling a Simple GSL Program
- From: Brian Gough <bjg at network-theory dot co dot uk>
- To: <banerjee at wernicke dot ccn dot upenn dot edu>
- Cc: gsl-discuss at sources dot redhat dot com
- Date: Tue, 19 Feb 2002 20:41:14 +0000 (GMT)
- Subject: Re: Error Compiling a Simple GSL Program
- References: <Pine.LNX.3.96.1020218210201.13304B-100000@wernicke.ccn.upenn.edu>
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