#56 Compile errors GCC 4.1.1

open
Peter C
5
2006-09-06
2006-09-06
Anonymous
No

Email:bug@bymeinc.com

reedsolomon.cpp:54: error: explicit specialization
of 'bool ReedSolomon<Galois<8u, 285u, unsigned char>
>::SetInput(const std::vector<bool,
std::allocator<bool> >&)' must be introduced
by 'template <>'
reedsolomon.cpp:54: error: template-id 'SetInput<>'
for 'bool ReedSolomon<Galois<8u, 285u, unsigned char>
>::SetInput(const std::vector<bool,
std::allocator<bool> >&)' does not match any template
declaration
reedsolomon.cpp:54: error: invalid function
declaration
reedsolomon.cpp:83: error: explicit specialization
of 'bool ReedSolomon<Galois<8u, 285u, unsigned char>
>::SetInput(u32)' must be introduced by 'template <>'
reedsolomon.cpp:83: error: template-id 'SetInput<>'
for 'bool ReedSolomon<Galois<8u, 285u, unsigned char>
>::SetInput(u32)' does not match any template
declaration
reedsolomon.cpp:83: error: invalid function
declaration
reedsolomon.cpp:104: error: explicit specialization
of 'bool ReedSolomon<Galois<8u, 285u, unsigned char>
>::Process(size_t, u32, const void*, u32, void*)'
must be introduced by 'template <>'
reedsolomon.cpp:104: error: template-id 'Process<>'
for 'bool ReedSolomon<Galois<8u, 285u, unsigned char>
>::Process(size_t, u32, const void*, u32, void*)'
does not match any template declaration
reedsolomon.cpp:104: error: invalid function
declaration
reedsolomon.cpp:192: error: explicit specialization
of 'bool ReedSolomon<Galois<16u, 69643u, short
unsigned int> >::SetInput(const std::vector<bool,
std::allocator<bool> >&)' must be introduced
by 'template <>'
reedsolomon.cpp:192: error: template-id 'SetInput<>'
for 'bool ReedSolomon<Galois<16u, 69643u, short
unsigned int> >::SetInput(const std::vector<bool,
std::allocator<bool> >&)' does not match any template
declaration
reedsolomon.cpp:192: error: invalid function
declaration
reedsolomon.cpp:236: error: explicit specialization
of 'bool ReedSolomon<Galois<16u, 69643u, short
unsigned int> >::SetInput(u32)' must be introduced
by 'template <>'
reedsolomon.cpp:236: error: template-id 'SetInput<>'
for 'bool ReedSolomon<Galois<16u, 69643u, short
unsigned int> >::SetInput(u32)' does not match any
template declaration
reedsolomon.cpp:236: error: invalid function
declaration
reedsolomon.cpp:270: error: explicit specialization
of 'bool ReedSolomon<Galois<16u, 69643u, short
unsigned int> >::Process(size_t, u32, const void*,
u32, void*)' must be introduced by 'template <>'
reedsolomon.cpp:270: error: template-id 'Process<>'
for 'bool ReedSolomon<Galois<16u, 69643u, short
unsigned int> >::Process(size_t, u32, const void*,
u32, void*)' does not match any template declaration
reedsolomon.cpp:270: error: invalid function
declaration
make[1]: *** [reedsolomon.o] Error 1

Discussion

  • ChazeFroy
    ChazeFroy
    2006-09-07

    Logged In: YES
    user_id=411113

    I get the same error with GCC 4.1.1 and glibc 2.4.

     
  • Logged In: NO

    edit reedsolomon.cpp

    and replace:
    bool ReedSolomon

    with:
    template <> bool ReedSolomon

    this helped for me

     
  • Logged In: YES
    user_id=22327
    Originator: NO

    debian etch has a patch that probably fixes this:

    ---[ 002-gcc_40_fixes.patch ]---------------------------->8======
    Package: par2cmdline
    Severity: normal
    Tags: patch

    When building 'par2cmdline' on amd64 with gcc-4.0,
    I get the following error:

    reedsolomon.cpp:83: error: explicit specialization of 'bool ReedSolomon<Galois8>::SetInput(u32)' must be introduced by 'template <>'
    reedsolomon.cpp:83: error: template-id 'SetInput<>' for 'bool ReedSolomon<Galois8>::SetInput(u32)' does not match any template declaration
    reedsolomon.cpp:83: error: invalid function declaration
    reedsolomon.cpp:104: error: explicit specialization of 'bool ReedSolomon<Galois8>::Process(size_t, u32, const void*, u32, void*)' must be introduced by 'template <>'
    reedsolomon.cpp:104: error: template-id 'Process<>' for 'bool ReedSolomon<Galois8>::Process(size_t, u32, const void*, u32, void*)' does not match any template declaration
    reedsolomon.cpp:104: error: invalid function declaration
    reedsolomon.cpp:192: error: explicit specialization of 'bool ReedSolomon<Galois16>::SetInput(const std::vector<bool, std::allocator<bool> >&)' must be introduced by 'template <>'
    reedsolomon.cpp:192: error: template-id 'SetInput<>' for 'bool ReedSolomon<Galois16>::SetInput(const std::vector<bool, std::allocator<bool> >&)' does not match any template declaration
    reedsolomon.cpp:192: error: invalid function declaration
    reedsolomon.cpp:236: error: explicit specialization of 'bool ReedSolomon<Galois16>::SetInput(u32)' must be introduced by 'template <>'
    reedsolomon.cpp:236: error: template-id 'SetInput<>' for 'bool ReedSolomon<Galois16>::SetInput(u32)' does not match any template declaration
    reedsolomon.cpp:236: error: invalid function declaration
    reedsolomon.cpp:270: error: explicit specialization of 'bool ReedSolomon<Galois16>::Process(size_t, u32, const void*, u32, void*)' must be introduced by 'template <>'
    reedsolomon.cpp:270: error: template-id 'Process<>' for 'bool ReedSolomon<Galois16>::Process(size_t, u32, const void*, u32, void*)' does not match any template declaration
    reedsolomon.cpp:270: error: invalid function declaration
    make[2]: *** [reedsolomon.o] Error 1
    make[2]: Leaving directory `/par2cmdline-0.4'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/par2cmdline-0.4'
    make: *** [debian/stamp-makefile-build] Error 2

    With the attached patch 'par2cmdline' can be compiled
    on amd64 using gcc-4.0.

    Regards
    Andreas Jochens

    diff -urN orig/reedsolomon.cpp mod/reedsolomon.cpp
    --- orig/reedsolomon.cpp 2003-05-26 20:01:31.000000000 +0200
    +++ mod/reedsolomon.cpp 2004-12-30 21:15:57.906327496 +0100
    @@ -51,7 +51,7 @@
    }
    }

    -bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
    +template <> bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
    {
    inputcount = (u32)present.size();

    @@ -80,7 +80,7 @@
    return true;
    }

    -bool ReedSolomon<Galois8>::SetInput(u32 count)
    +template <> bool ReedSolomon<Galois8>::SetInput(u32 count)
    {
    inputcount = count;

    @@ -101,7 +101,7 @@
    return true;
    }

    -bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
    +template <> bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
    {
    // Look up the appropriate element in the RS matrix
    Galois8 factor = leftmatrix[outputindex * (datapresent + datamissing) + inputindex];
    @@ -189,7 +189,7 @@

    // Set which of the source files are present and which are missing
    // and compute the base values to use for the vandermonde matrix.
    -bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
    +template <> bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
    {
    inputcount = (u32)present.size();

    @@ -233,7 +233,7 @@

    // Record that the specified number of source files are all present
    // and compute the base values to use for the vandermonde matrix.
    -bool ReedSolomon<Galois16>::SetInput(u32 count)
    +template <> bool ReedSolomon<Galois16>::SetInput(u32 count)
    {
    inputcount = count;

    @@ -267,7 +267,7 @@
    return true;
    }

    -bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
    +template <> bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
    {
    // Look up the appropriate element in the RS matrix

    =====8<----[ end 002-gcc_40_fixes.patch ]------------------------

    the changelog tells

    par2cmdline (0.4-2) unstable; urgency=low

    * Fix gcc-4.0 build failures; thanks to Andreas Jochens (closes: #287904).

     
  • Ken Yap
    Ken Yap
    2008-04-02

    Logged In: YES
    user_id=23461
    Originator: NO

    Same here with gcc 4.2.1, though the error message is shorter:

    reedsolomon.cpp:54: error: too few template-parameter-lists

    and lots of warnings for every file:

    par1fileformat.h:41: warning: ignoring packed attribute because of unpacked non-POD field ‘MD5Hash PAR1FILEHEADER::controlhash’
    par1fileformat.h:42: warning: ignoring packed attribute because of unpacked non-POD field ‘MD5Hash PAR1FILEHEADER::sethash’
    par1fileformat.h:56: warning: ignoring packed attribute because of unpacked non-POD field ‘MD5Hash PAR1FILEENTRY::hashfull’
    par1fileformat.h:57: warning: ignoring packed attribute because of unpacked non-POD field ‘MD5Hash PAR1FILEENTRY::hash16k’

     
  • sergey
    sergey
    2009-03-08

    > edit reedsolomon.cpp
    > and replace:
    > bool ReedSolomon
    > with:
    > template <> bool ReedSolomon
    > this helped for me

    Thank you! This helped for me too. With this recommendation I compile par2 on Slackware 12.1.