<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Hi all<br>
    <br>
    I'm currently writing C++ code that I want to use via Python with
    SIP. The following is a skeleton for my code:<br>
    <br>
    <blockquote><i>template&lt;class T&gt;<br>
        class MyClass<br>
        {<br>
        &nbsp;&nbsp;&nbsp; </i><i>MyClass</i><i>(QString s);<br>
        &nbsp;&nbsp;&nbsp; T* calculate();<br>
        }<br>
        <br>
        class B<br>
        {<br>
        &nbsp;&nbsp;&nbsp; B();<br>
        &nbsp;&nbsp;&nbsp; void doStuff();<br>
        }<br>
        <br>
        void B::doStuff()<br>
        {<br>
        &nbsp;&nbsp;&nbsp; </i><i>MyClass</i><i>&lt;int&gt; var("");<br>
        &nbsp;&nbsp;&nbsp; int *var2 = var.calculate();<br>
        }<br>
        <br>
      </i></blockquote>
    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:<br>
    <br>
    <blockquote><i>&nbsp; File
        "/home/goocreations/apps/share/qgis/python/qgis/utils.py", line
        283, in _import</i><br>
      <i>&nbsp;&nbsp;&nbsp; mod = _builtin_import(name, globals, locals, fromlist,
        level)</i><br>
      <i>ImportError:
        /home/goocreations/apps/lib/libqgis_mylib.so.1.7.0: undefined
        symbol: _ZN15</i><i>MyClassIiEC1E7QString</i><br>
      <br>
    </blockquote>
    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&nbsp; of how Python
    gives an error on code that isn't linked to SIP.<br>
    <br>
    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.<br>
    <br>
    By the may: when I remove the template from MyClass and make
    everything by default int, everything compiles and runs perfectly.<br>
    <br>
    Does anyone have an idea of why this is happening, or if I maybe
    have to include something special in the cmake files?<br>
    <br>
    Thanks<br>
    <br>
    Chris<br>
  </body>
</html>