0

I want to use GotoBLAS2 to sum two vectors (z = x+y, where x and y are two vectors with the same length). I use following code:

#include <stdio.h>
#include <cblas.h>
#include <common.h>

double x[] = {1,2,3};
double y[] = {4,5,6};

void main()
{
int n,i,x_int,y_int=5,a;
n=3;x_int=1;y_int=1;a=1;
cblas_dzxpy(n, a, &x[0], x_int, &y[0], y_int);
for(i=0;i<n;i++) printf("x[%d] = %g\n", i, x[i]);
}

this file is located at some directory "Test" and GotoBLAS2 is at the directory with TEST (not file). Also, I put libgoto2.a in TEST folder. When I want to compile it using following command:

gcc AddSubVectors.c -I../GotoBLAS2 -L../GotoBLAS2 libgoto2.a

I get following error several times:

../GotoBLAS2/cblas.h:270:45: error: unknown type name 'blasint'

it seems I have to link something to gcc but I do not know what and how. Any help is really appreciated. Thanks

Pouya
  • 1,871
  • 3
  • 20
  • 25
  • Can you look in cblas.h and see how the `blasint` type is defined? Maybe there is a compiler definition you need to turn on for it to work. – WildCrustacean Jan 25 '13 at 17:34

1 Answers1

0

Thanks for your quick reply. Using your hint, I figured the problem. Actually, blasint was defined in common.h and since in my code #include <cblas.h> was before #include <common.h>, gcc couldn't find the definition for blasint.

Again thanks

Pouya
  • 1,871
  • 3
  • 20
  • 25