[bigint] compile error (<X> on g++ 3.2.3)
Matt McCutchen <matt at mattmccutchen.net>
Thu Oct 2 18:52:41 PDT 2008
On Wed, 2008-10-01 at 00:21 -0500, Jeanna Matthews wrote:
> I downloaded the package, but am having trouble compiling it with g++
> on Linux.
>
> It appears not to recognize the <X> in this:
>
> template <class X>
> inline X convertBigUnsignedToPrimitiveAccess(const BigUnsigned &a) {
> return a.convertToPrimitive<X>();
> }
> [bigint-2008.07.20]$ make
> g++ -c -O2 -Wall -pedantic BigInteger.cc
> BigInteger.cc: In function `X
> convertBigUnsignedToPrimitiveAccess(const
> BigUnsigned&)':
> BigInteger.cc:89: syntax error before `>' token
> make: *** [BigInteger.o] Error 1
> [jnm at polaris bigint-2008.07.20]$ g++ -v
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
> Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
> --infodir=/usr/share/info --enable-shared --enable-threads=posix
> --disable-checking --with-system-zlib --enable-__cxa_atexit
> --host=i386-redhat-linux
> Thread model: posix
> gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-59)
Your g++ seems to dislike my use of explicit template arguments, but I'm
surprised it didn't complain about the <X> in BigUnsigned.hh. Consider
upgrading g++. I can compile the library just fine with g++ 4.3.0 and
with g++ 3.4.6. Alternatively, you could apply the attached patch,
which removes the explicit template arguments. (The patched version is
also in branch "no-explicit-template-args" of my repository.)
Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: no-explicit-template-args.diff
Type: text/x-patch
Size: 6741 bytes
Desc: not available
URL: <http://mattmccutchen.net/mailman/archives/bigint/attachments/20081002/c7cdd96c/attachment.bin>
More information about the bigint
mailing list