pyrex problems

"Marco Zanger" <[email protected]>
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
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

_______________________________________________
Pyrex mailing list
[email protected]
http://lists.copyleft.no/mailman/listinfo/pyrex
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.