title: error: no matching function for call to 'function namel'
body: <p>My final goal is to compute the power of a quadratic ideal which is implemented as struct variables in C using GMP library.</p>
  
  <p>I have been given a library(ANTL), which contains generic optimized exponentiations using C++ templates, namespaces and NTL. This library does exponentiation for NTL types ZZ_p etc. and basic types like long, float etc..</p>
  
  <p>I have to use the ANTL library to achieve my final goal - computing the power of an ideal, a <em>C struct variable</em>. Since I have never worked with templates and namespaces before I wanted to implement the power of a basic mpz_t variable before to see how everything works.</p>
  
  <p>Now, I have four header files exp.hpp, expbin.hpp, impl.hpp, com.hpp and a main file exp.cpp as follows - </p>
  
  <p><strong>COM.HPP</strong></p>
  
  <pre><code>#ifndef GMPL_COM_H
  #define GMPL_COM_H
  
  #include &lt;gmp.h&gt;
  
  namespace GMPL {
      template &lt; class T &gt;
      inline void assign(T C, const T A)
      {
          mpz_set(C, A);
      }
  
      template&lt;class T&gt;
      void mul (T C, const T A, const T B)
      {
          mpz_mul(C, A, B);
      }
  
      template&lt;class T&gt;
      void sqr (T C, const T A)
      {
          mpz_mul(C, A, A);
      }
  
  }
  #endif // guard
  </code></pre>
  
  <p><strong>EXP.HPP</strong></p>
  
  <pre><code>#ifndef EXP_H
  #define EXP_H
  
  #include "com.hpp"
  
  namespace GMPL
  {
      template &lt; class T &gt;
      class exp
      {
          public:
          exp() {};
          virtual ~exp() {};
  
          virtual void power (T C, const T A, const NTL::ZZ &amp; n) = 0;
      };
  
  } // GMPL
  
  #endif // EXP_H
  </code></pre>
  
  <p><strong>EXPBIN.HPP</strong></p>
  
  <pre><code>#ifndef EXPBIN_H
  #define EXPBIN_H
  
  #include "exp.hpp"
  
  namespace GMPL
  {
      template &lt; class T &gt;
      class expbin : public exp&lt;T&gt;
      {
          public:
          expbin() {};
          ~expbin() {};
  
          void power (T C, const T A, const NTL::ZZ &amp; n);
      };
  
  } // GMPL
  
  // Unspecialized template definitions.
  #include "impl.hpp"
  
  #endif // EXPBIN_H
  </code></pre>
  
  <p><strong>IMPL.HPP</strong></p>
  
  <pre><code>using namespace GMPL;
  
  //
  // compute A^n using standard left-to-right binary method
  //
  template &lt; class T &gt; 
  void expbin&lt;T&gt;::power (T C, const T A, const NTL::ZZ &amp; n)
  {
      assign(C,A);
      for (register long i = NumBits(n)-2 ; i &gt;= 0 ; i--)
      {
          sqr(C, C);
          if (bit(n, i) == 1)
              mul(C, C, A);
      }
  }
  </code></pre>
  
  <p><strong>EXP.CPP</strong></p>
  
  <pre><code>#include &lt;NTL/lzz_p.h&gt;
  #include &lt;gmp.h&gt;
  
  namespace GMPL {}
  using namespace GMPL;
  
  
  #include "expbin.hpp"
  
  NTL_CLIENT
  
  int main ()
  {
      // NTL variables
      ZZ n;
  
      // GMP variables
      mpz_t aa;
      mpz_t bb;
      mpz_init(aa);
      mpz_init(bb);
  
      // generate random exponent of size 512 bits
      RandomLen (n, 512); // NTL function
  
      // initialize exponentiation classes
      expbin&lt;mpz_t&gt; obj;
  
      // compute a^n with available methods
      obj.power (bb,aa,n);
  
      // check and output results
      gmp_printf("%Zd", bb);
  }
  </code></pre>
  
  <p>when I try to compile <strong>EXP.CPP</strong> using (as mentioned on Victor Shoup's NTL documentation online)</p>
  
  <pre><code>g++ -g -O2 -std=c++11 -pthread -march=native exp.cpp -o t -lntl -lgmp -lm
  </code></pre>
  
  <p>I get the following error messages-</p>
  
  <pre><code>$ g++ -g -O2 -std=c++11 -pthread -march=native exp.cpp -o t -lntl -lgmp -lm
  In file included from exp.cpp:8:
  In file included from ./expbin.hpp:46:
  ./impl.hpp:16:10: warning: 'register' storage class specifier is deprecated and
        incompatible with C++1z [-Wdeprecated-register]
      for (register long i = NumBits(n)-2 ; i &gt;= 0 ; i--)
           ^~~~~~~~~
  ./impl.hpp:15:5: error: no matching function for call to 'assign'
      assign(C,A);
      ^~~~~~
  exp.cpp:28:9: note: in instantiation of member function
        'GMPL::expbin&lt;__mpz_struct [1]&gt;::power' requested here
      obj.power (bb,aa,n);
          ^
  ./com.hpp:16:17: note: candidate template ignored: deduced conflicting types for
        parameter 'T' ('__mpz_struct *' vs. 'const __mpz_struct *')
      inline void assign(T C, const T A)
                  ^
  In file included from exp.cpp:8:
  In file included from ./expbin.hpp:46:
  ./impl.hpp:20:13: error: no matching function for call to 'mul'
              mul(C, C, A);
              ^~~
  ./com.hpp:22:10: note: candidate template ignored: deduced conflicting types for
        parameter 'T' ('__mpz_struct *' vs. 'const __mpz_struct *')
      void mul (T C, const T A, const T B)
  </code></pre>
  
  <p>Assiduous googling about these errors shows that one has to have an empty constructor in the parent class but I already have it. </p>
  
  <p>I know the compile statement is correct because other than that nothing else works when using NTL. At this point I ran out of ideas to fix this. Thanks in advance.</p>
  
  <p><strong>EDIT</strong>
  This question has been resolved. I wish for this question to be closed or removed.</p>