Re: compiling taucs problem (Re: solving Ax=b with sparse A)



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 find
the 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


.



Relevant Pages

  • Re: Strange function use
    ... int foo(int f) ... Compiling the code with ... It's not a /call/ but a declaration - it's say that foo is a function ...
    (comp.lang.c)
  • Re: Strange function use
    ... int foo(int f) ... Compiling the code with ... It's not a /call/ but a declaration - it's say that foo is a function ...
    (comp.lang.c)
  • Re: Variable declaration: Global vs. Function
    ... Unix libraries and builds have always been a ... and how it differs from construction of function-local ... do any of your global objects depend upon ... Its only the global declaration that is the ...
    (comp.lang.cpp)
  • Re: Bands on an EEE PC
    ... I have tried the compiled linux install ... This is almost certainly an issue about libraries. ... the simplest in terms of library deps) and try compiling it. ...
    (rec.games.roguelike.angband)
  • Re: how to declare global Class library project?
    ... Easist way would be a web service. ... In .NET libraries are loaded into their calling process. ... supporting remoting (i.e a winforms app that has a singleton instance of the ... > referencing this global declaration from each of the 2 ...
    (microsoft.public.dotnet.languages.vb)