Hi, I&#39;ve been reading the <a href="http://wiki.cython.org/WrappingCPlusPlus" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">WrappingC++</a> code with pyrex/Cython. But I&#39;m still unable to compile it; even the attached example.<br>

<br>when I run&nbsp; &quot;pyrexc rectangle.pyx &quot;<br>I get:<br><br>.../rectangle.pyx:29:27: Syntax error in C variable declaration<br>
<br>Which refers to<br><br>&nbsp;&nbsp;&nbsp; def __add__(Rectangle left, Rectangle right):<br><span style="font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cdef c_Rectangle c = left.thisptr.add(right.thisptr[0])</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cdef Rectangle sum = Rectangle(c.x0, c.y0, c.x1, c.y1)<br>


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return sum<br><br><span style="text-decoration: underline;">And in my own code i get the following</span><br><br>GOptimization.pyx:91:32: Object of type &#39;cGCoptimization&#39; has no attribute &#39;expansionIter&#39;<br>

<br>And the code which refers is<br>
<br><span style="font-family: courier new,monospace;">cdef extern </span><span style="color: rgb(51, 51, 255); font-family: courier new,monospace;">from</span><span style="font-family: courier new,monospace;"> </span><span style="color: rgb(51, 204, 0); font-family: courier new,monospace;">&quot;GCoptimization.h&quot;</span><span style="font-family: courier new,monospace;">:</span><br style="font-family: courier new,monospace;">


<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; ctypedef int PixelType</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; ctypedef struct cGCoptimization </span><span style="color: rgb(51, 204, 0); font-family: courier new,monospace;">&quot;GCoptimization&quot;</span><span style="font-family: courier new,monospace;">:</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EnergyType expansionIter &quot;expansion&quot;(int max_num_iterations)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; </span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; cGCoptimization *newGCoptimization </span><span style="color: rgb(51, 204, 0); font-family: courier new,monospace;">&quot;new GCoptimization&quot; </span><span style="font-family: courier new,monospace;">(PixelType num_pixels,int num_labels,int dataSetup, int smoothSetup)</span><br style="font-family: courier new,monospace;">


<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; void delGCOptimization </span><span style="color: rgb(51, 204, 0); font-family: courier new,monospace;">&quot;delete&quot; </span><span style="font-family: courier new,monospace;">(cGCoptimization *optimization)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><br style="font-family: courier new,monospace;">


<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">cdef </span><span style="color: rgb(51, 51, 255); font-family: courier new,monospace;">class</span><span style="font-family: courier new,monospace;"> GCoptimization:</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; cdef cGCoptimization *optimization</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(51, 51, 255); font-family: courier new,monospace;">def</span><span style="font-family: courier new,monospace;"> __new__(self, num_pixels, num_labels, dataSetup, smoothSetup):</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.optimization = newGCoptimization(num_pixels, num_labels, dataSetup, smoothSetup)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(51, 51, 255); font-family: courier new,monospace;">def</span><span style="font-family: courier new,monospace;"> __dealloc__(self):</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delGCOptimization(self.optimization)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; def expansionIter(self,max_num_iterations):</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace; font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(51, 51, 255); font-family: courier new,monospace; font-weight: bold;">return</span><span style="font-family: courier new,monospace; font-weight: bold;"> self.optimization.expansionIter(max_num_iterations)</span><br style="font-weight: bold;">


<br>If u have any idea to give I would appreciate it very much, I&#39;m kind of lost in here.<br><br>Thank you, again,<br>Warmest Regards,<br><span>Marco</span>