[Pyrex] pyrex problems
Marco Zanger
marcozanger at gmail.com
Tue Apr 22 00:27:47 CEST 2008
Hi, I've been reading the
WrappingC++<http://wiki.cython.org/WrappingCPlusPlus>code with
pyrex/Cython. But I'm still unable to compile it; even the
attached example.
when I run "pyrexc rectangle.pyx "
I get:
.../rectangle.pyx:29:27: Syntax error in C variable declaration
Which refers to
def __add__(Rectangle left, Rectangle right):
cdef c_Rectangle c = left.thisptr.add(right.thisptr[0])
cdef Rectangle sum = Rectangle(c.x0, c.y0, c.x1, c.y1)
return sum
And in my own code i get the following
GOptimization.pyx:91:32: Object of type 'cGCoptimization' has no attribute
'expansionIter'
And the code which refers is
cdef extern from "GCoptimization.h":
ctypedef int PixelType
ctypedef struct cGCoptimization "GCoptimization":
EnergyType expansionIter "expansion"(int max_num_iterations)
cGCoptimization *newGCoptimization "new GCoptimization" (PixelType
num_pixels,int num_labels,int dataSetup, int smoothSetup)
void delGCOptimization "delete" (cGCoptimization
*optimization)
cdef class GCoptimization:
cdef cGCoptimization *optimization
def __new__(self, num_pixels, num_labels, dataSetup, smoothSetup):
self.optimization = newGCoptimization(num_pixels, num_labels,
dataSetup, smoothSetup)
def __dealloc__(self):
delGCOptimization(self.optimization)
def expansionIter(self,max_num_iterations):
return self.optimization.expansionIter(max_num_iterations)
If u have any idea to give I would appreciate it very much, I'm kind of lost
in here.
Thank you, again,
Warmest Regards,
Marco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.copyleft.no/pipermail/pyrex/attachments/20080422/6a0949a3/attachment.html
More information about the Pyrex
mailing list