title: Python argument types did not match c++ signature - Boost.Python
body: <p>I am just starting to explore using Boost.Python to wrap some c++ code.  I am starting with a toy problem to work out the basic issues but don't understand the error I'm getting.</p>
  <pre><code>#include &quot;pch.h&quot;
  #include &lt;boost/python.hpp&gt;
  #include &lt;boost/python/def.hpp&gt;
  #include &lt;boost/python/args.hpp&gt;
  
  
  class Parameters
  {
  public:
      int a;
      void seta(int val) { a = val; }
      int geta() { return a; }
      void add(int first, int second) { a = first + second; }
  
  };
  
  
  BOOST_PYTHON_MODULE(my_lib) {
  
      boost::python::class_&lt;Parameters&gt;(&quot;Parameters&quot;)
          .add_property(&quot;a&quot;, &amp;Parameters::geta, &amp;Parameters::seta)
          .def(&quot;add&quot;, &amp;Parameters::add, boost::python::args(&quot;first&quot;, &quot;second&quot;));
  
  }
  </code></pre>
  <p>The python script, also simple is:</p>
  <pre><code>#Test program to use simple c++ dynamic library binding
  
  import sys
  import my_lib
  import ctypes
  
  if __name__ == '__main__':
  
   
      my_lib.Parameters.a = 9
  
      result = my_lib.Parameters.a
  
      print(&quot;result = &quot;,result)
  
      my_lib.Parameters.add(2,3)
  
      sumresult = badprog_lib1.Parameters.a
  
      print(&quot;sum result = &quot;, sumresult)
  </code></pre>
  <p>When I run the python, I get the following:</p>
  <pre><code>result =  9
  Traceback (most recent call last):
    File &quot;C:/Users/strat/source/repos/badprog_lib1/LibClient2.py&quot;, line 19, in &lt;module&gt;
      my_lib.Parameters.add(2,3)
  Boost.Python.ArgumentError: Python argument types in
      Parameters.add(int, int)
  did not match C++ signature:
      add(class Parameters {lvalue}, int first, int second)
  </code></pre>
  <p>It is complaining about parameter mismatch between the c++ and Boost.Python arguments.  One thing I don't understand is why the C++ signature includes &quot;class Parameters {lvalue}&quot; and am wondering if that's a clue.  Any help from you more experienced Boost users would be greatly appreciated.</p>