Dear support,
I am using openSuse 10.3 and using GCC.
I have built a small test file to try and call one of the CLAPACK function
"spotrf".
I have already built all the libraries(BLAS, F2C, LAPACK) as describes in the
install file over netlib.
I am using the included standard BLAS library.
I have included all the .h files in my test program and all the includes and
the libs in the make file as well.
Problem is it compiles successfully yet at the linking phase it logs error:
Test.o: In function `main':
/home/mfahmy/Documents/SatoLabProj/Trial/Test.c:62: undefined reference to
`spotrf_'
collect2: ld returned 1 exit status
make: *** [build] Error 1
Please help, I really don't know what to do?!
this is my test file source code:
#include "f2c.h"
#include "clapack.h"
#include "blaswrap.h"
#include "cblas.h"
#include "fblaswr.h"
extern int spotrf_(char *uplo, integer *n, real *a, integer *lda, integer
*info);
int main(void)
{
char uplo;
integer n, lda, info;
int i, j, temp, retval;
n = 4;
lda = 4;
uplo = 'L';
info = 0;
real a[lda*n];
/* Matrices Random Initialization */
if(uplo == 'L' || uplo == 'l')
{
temp = 0;
for(j = 0; j < n; j++)
{
for(i = temp; i < lda; i++)
a[j*lda + i]= j*lda + i;
temp++;
}
temp = 0;
for(j = 0; j < n; j++)
{
for(i = 0; i < temp; i++)
a[j*lda + i]= a[i*n + j];
temp++;
}
}
else if(uplo == 'U' || uplo == 'u')
{
temp = 1;
for(j = 0; j < n; j++)
{
for(i = 0; i < temp; i++)
a[j*lda + i]= j*lda + i;
temp++;
}
temp = 1;
for(j = 0; j < n; j++)
{
for(i = temp; i < lda; i++)
a[j*lda + i]= a[i*n + j];
temp++;
}
}
/* SPOTRF */
spotrf_(&uplo, &n, a, &lda, &info);
return 1;
}
and this is my make file:
all: build
COMPILER = gcc
INCS = -I./clapack/CLAPACK-3.1.1/BLAS/WRAP/ -I./clapack/CLAPACK-3.1.1/BLAS/SRC/
-I./clapack/CLAPACK-3.1.1/F2CLIBS/ -I./clapack/CLAPACK-3.1.1/F2CLIBS/libf2c/
-I./clapack/CLAPACK-3.1.1/INCLUDE/ -I./clapack/CLAPACK-3.1.1/SRC/
LIBS = -L./clapack/CLAPACK-3.1.1/-llapack_LINUX.a
-L./clapack/CLAPACK-3.1.1/-lblas_LINUX.a
-L./clapack/CLAPACK-3.1.1/F2CLIBS/-llibf2c.a
LINK_FLAGS = -v -o test
COMPILE_FLAGS = -c -v -g -use_fast_math -O0
build: Test.o
$(COMPILER) Test.o $(LINK_FLAGS) $(INCS) $(LIBS)
Test.o: Test.c
$(COMPILER) Test.c $(COMPILE_FLAGS) $(INCS) $(LIBS)
clean:
rm Test Test.o
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces.
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
|