Hi all

I'm currently writing C++ code that I want to use via Python with SIP. The following is a skeleton for my code:

   /template<class T>
   class MyClass
   {
   //MyClass//(QString s);
        T* calculate();
   }

   class B
   {
        B();
        void doStuff();
   }

   void B::doStuff()
   {
   //MyClass//<int> var("");
        int *var2 = var.calculate();
   }

   /

The only class I've included in my SIP file is class B (and not class A). Everything compiles correctly, but when QGIS starts, I get a Python error:

   /  File "/home/goocreations/apps/share/qgis/python/qgis/utils.py",
   line 283, in _import/
   /    mod = _builtin_import(name, globals, locals, fromlist, level)/
   /ImportError: /home/goocreations/apps/lib/libqgis_mylib.so.1.7.0:
   undefined symbol: _ZN15//MyClassIiEC1E7QString/

This error seems strange, since I've never included MyClass in the SIP files and the only place MyClass is instantiated is in my cpp file (I didn't even include the MyClass directory in the cmake file that handles the SIP files). So I'm a bit confused of how Python gives an error on code that isn't linked to SIP.

So, I've though that creating a SIP binding for MyClass may resolve the issue, but I can't figure out how I would use templates in SIP.

By the may: when I remove the template from MyClass and make everything by default int, everything compiles and runs perfectly.

Does anyone have an idea of why this is happening, or if I maybe have to include something special in the cmake files?

Thanks

Chris
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to