Re: compiling taucs problem (Re: solving Ax=b with sparse A)
- From: "H.S." <hs.saDELETEMEmix@xxxxxxxxx>
- Date: Thu, 09 Aug 2007 12:28:12 -0400
Georg Baum wrote:
The compiler tells it: The function declaration in line 6 of spmat.cc
conflicts with the declaration in taucs_private.h, line 45. It should work
if you remove your own declaration in spmat.cc.
In general it should not be needed to declare anything from a library, the
library author should have done that in the header files already. If this
is not the case then I'd question the quality of the library (the only
exception are fortran libraries that you call from C, then you usually need
to build your own declarations).
Georg
Okay, that makes sense. I also got similar advice from comp.lang.c++.
(the people there are fanatically picky about talking about *only* about
C++ language ... so I don't think I get further insights from there).
I tried it again without the extern keyword. Here is my example program
I am trying now:
-----------------------------------------------------------
#define TAUCS_CORE_DOUBLE
#include <taucs.h>
extern taucs_ccs_matrix* taucs_ccs_create(int m,int n,int nnz,int flags);
extern void taucs_ccs_free(taucs_ccs_matrix* matrix);
int main(){
int C,R,k;
C=20;
R=20;
k=4;
taucs_ccs_matrix *taucAsigmaIMat;
taucAsigmaIMat = taucs_ccs_create(C, R, (k+1)*C,
TAUCS_DOUBLE|TAUCS_SYMMETRIC);
//cleanup
taucs_ccs_free(taucAsigmaIMat);
return 0;
}
-----------------------------------------------------------
The external linkare error has gone, but now I am getting linker errors.
From the errors it appears that my source file's object file cannot findthe two functions (see below) but I do not see why this is happenning.
The taucs library I am linking to has the symbols in it (checked with
nm) and as far as I can see, I am giving the correct library path as well:
$> make
g++ -g -ansi -Wall -c -Wno-deprecated -I./
-I/home/hs/tmp/taucs/build/linux -I/home/hs/tmp/taucs/src spmat.cc -o
spmat.o
g++ spmat.o -o spmat -L/home/hs/tmp/taucs/lib/linux -ltaucs
-L/home/hs/tmp/taucs/external/lib/linux -latlas -llapack -lf77blas
-lcblas -latlas -lmetis -lm -lg2c
spmat.o: In function `main':
/home/hs/tmp/spmat/spmat.cc:15: undefined reference to
`taucs_ccs_create(int, int, int, int)'
/home/hs/tmp/spmat/spmat.cc:18: undefined reference to
`taucs_ccs_free(taucs_ccs_matrix*)'
collect2: ld returned 1 exit status
make: *** [spmat] Error 1
I recall that I compiled the taucs library using CC=gcc during the make
step. I can't see what I am doing wrong while compiling the example
program above, do you think there could be a problem in compiling the
taucs library to begin with?
thanks,
->HS
.
- Follow-Ups:
- Re: compiling taucs problem (Re: solving Ax=b with sparse A)
- From: Georg Baum
- Re: compiling taucs problem (Re: solving Ax=b with sparse A)
- References:
- solving Ax=b with sparse A
- From: H.S.
- Re: solving Ax=b with sparse A
- From: Evgenii Rudnyi
- compiling taucs problem (Re: solving Ax=b with sparse A)
- From: H.S.
- Re: compiling taucs problem (Re: solving Ax=b with sparse A)
- From: Georg Baum
- solving Ax=b with sparse A
- Prev by Date: Looking for Linux optimal control programs
- Next by Date: Re: Problems with CLAPACK SVD routines on OS X
- Previous by thread: Re: compiling taucs problem (Re: solving Ax=b with sparse A)
- Next by thread: Re: compiling taucs problem (Re: solving Ax=b with sparse A)
- Index(es):
Relevant Pages
|