This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Error Compiling a Simple GSL Program
- From: <banerjee at wernicke dot ccn dot upenn dot edu>
- To: gsl-discuss at sources dot redhat dot com
- Date: Mon, 18 Feb 2002 21:06:25 -0500 (EST)
- Subject: Error Compiling a Simple GSL Program
Folks,
I am trying to compile a simple GSL program, using cblas_ddot(),
I am having linking errors.
Here's the source code (in the file gsl.cpp):
#include <stdio.h>
#include <gsl/gsl_cblas.h>
int main(int argc, char *argv[])
{
double vec1[10];
double vec2[10];
for (int i = 0; i < 10; i++)
{
vec1[i] = (double ) i;
vec2[i] = (double ) i;
} // for i
printf("inner prod = [%g]\n", cblas_ddot(10, vec1, sizeof(double),
vec2, sizeof(double)));
return 0;
} // main
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
I am using gcc 2.95.2, on a RedHat 6.2 Linux box. The GSL
include files are in /usr/local/include/gsl and the GSL libraries
are in /usr/local/lib, including libgslcblas.a.
The result of doing "nm libgslcblas.a | grep cblas_ddot" is:
00000000 T cblas_ddot
Thanks for the help.
K. Banerjee