[Pyrex] visual studio c/cpp problem

Robert Bradshaw robertwb at math.washington.edu
Thu May 28 22:30:13 CEST 2009


On May 27, 2009, at 10:28 PM, horace wrote:

> hello,
>
> i try to wrap a c library.
>
> when trying to compile with setup.py, the visual studio compiler  
> always gives me hundreds of those error messages: "error C2059:  
> syntax error : 'string'"
>
> i did some experiments with a manually created visual studio  
> project and figured out that compiling works if i rename the  
> generated .c file to .cpp. i guess the pure c compiling mode of  
> visual studio is a bit touchy about the files of the library i want  
> to wrap?
>
> is there a way (some setup.py setting?) to cause pyrex/cython to  
> create .cpp files instead of .c files? or can the c++ mode of  
> visual studio be forced somehow?

Shouldn't setting the langauge parameter work? E.g.

     Extension('foo',
               sources = ['foo.pyx'],
               language='c++'),


- Robert





More information about the Pyrex mailing list