[Dar-libdar_api] Re: [Dar-discussions] Re: problem testing infinint value
For full, incremental, compressed and encrypted backups or archives
Brought to you by:
edrusb
|
From: Johnathan B. <jk...@sh...> - 2004-06-24 22:08:54
|
On June 24, 2004 01:36 pm, Denis Corbin wrote:
> Johnathan Burchill wrote:
> > Hi Denis,
>
> hello Johnathan,
>
> > This code has worked up until now.
> >
> > QString plural("s ");
> > libdar::statistics st=3Dop_test(theArchive, selection, subtree,
> > verbose); if (st.errored =3D=3D libdar::infinint(1)) plural =3D " ";
> >
> > It compiles fine (dar-2.1.3), but I get the following linker error:
> >
> >[...]
> >
> > *testArchiveThread.o(.text+0x2dd): In function
> > `testArchiveThread::run()': *: undefined reference to `void
> > libdar::limitint<unsigned long long>::limitint_from<long>(long)'
> > *collect2: ld returned 1 exit status
> > *Making all in doc
> > *gmake[2]: *** [kdar] Error 1
> > *gmake[2]: Target `all' not remade because of errors.
> > *
> >
> > The only change was to put the code into a separate .cpp file, which
> > compiles okay. When the code was inside my kdar.cpp file, there was no
> > problem during linkage.
>
> Have you checked the files included in kdar.cpp against those included
> in your separated file ? Has the compiler been changed ?
Ah! The missing code was
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
And it has to be at the beginning of the .cpp files.
Thanks for the suggestion!
[...]
>
> for what it seems, the constant '1' in the expression, is cast as "long"
> before being given to the limitint constructor. This is wrong because
> there limitint is *unsigned* and cannot be built from *signed* integers.
[...]
>
> To fix the problem, I suggest an explicit cast:
>
> if (st.errored =3D=3D libdar::infinint((U_I)1) plural =3D " ";
>
> U_I is a libdar macro, system independent, matching an unsigned integer.
> (see "libdar/integers.hpp"), but if you prefer you can safely replace it
> by "unsigned int".
Signed long integers I can pass to the infinint constructor, and it work=20
okay. They must get cast implicitly by the library.
[...]
> Cheers,
> Denis.
>
> P.S.: it should be more appropriate to post to lidar-api mailing-list
> rather than to this general discussion mailing-list for such problems.
> Thanks.
No problem --- I should have considered this in the first place.
[...]
Cheers,
JB
=2D-=20
Johnathan K. Burchill, Ph.D.
Department of Physics and Astronomy
University of Calgary
2500 University Drive N.W.
Calgary, AB T2N 1N4
Canada
(403) 217-4286
jk...@sh...
|