[PyQt] SIP default constructor issue

Phil Thompson phil at riverbankcomputing.com
Sat Feb 4 10:14:43 GMT 2017


On 4 Feb 2017, at 1:31 am, Kelvin Rodriguez <kr788 at nau.edu> wrote:
> 
> Hi all,
> 
> 
> 
> I am trying to wrap fairly large C++ api using SIP. In trying to build the module, I get the error:
> 
> 
> 
> ./sipbundleIsisBundleImage.cpp: In function ‘void* array_Isis_BundleImage(Py_ssize_t)’:
> 
> ./sipbundleIsisBundleImage.cpp:86:43: error: no matching function for call to ‘Isis::BundleImage::BundleImage()’
> 
>     return new Isis::BundleImage[sipNrElem];
> 
> 
> 
> We do not user the default contractor in our codebase, so one does exist for the class BundleImage. It seems like SIP requires there to exist a default constructor for the wrapped class? This can be fixed easily by adding a default contractor to the C++ class being wrapped, but I would like to avoid it if possible. 
> 
> 
> 
> My questions are: Does SIP allow for a clean way to eliminate this error without changing the codebase being wrapped? Does SIP actually require a default constructor or is there something I am doing wrong? 
> 
> 
> 
> The .sip for bundle Image is as barebones as the class:
> 
> 
> 
> namespace Isis {
> 
>  class BundleImage {
> 
>  %TypeHeaderCode
> 
>    #include "BundleImage.h"
> 
>  %End
> 
> 
> 
>  public:
> 
> 
> 
>    QString serialNumber();
> 
>    QString fileName();
> 
>  };
> 
> };

C++ will generate a default ctor in the above case which SIP will create a wrapper for. If the above fails then it suggests your C++ is actually disabling the default ctor - so you should reflect that in the .sip file.

Phil


More information about the PyQt mailing list