[Pyrex] pyrex and g++
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Sep 23 05:22:56 CEST 2005
Simon Burton wrote:
> I'm trying to compile some pyrex output with g++. (my project involves
> wrapping a c++ library that has a c interface).
>
> $ g++ -c test.c -I/usr/include/python2.3/
> test.c:156: error: redefinition of `PyTypeObject __pyx_type_4test_A'
> etc...
Pyrex generates C code, not C++ code, meaning you have to
compile its output as C, not C++. In other words, use
the command 'gcc', not 'g++'.
If the library really does have a C interface, there should
be no problem linking the resulting .o file with the library.
One caveat is that the .h file must be suitably #ifdefed so
that it can be processed as plain C. If not, you'll have to
tweak it or write an alternative one.
--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg.ewing at canterbury.ac.nz +--------------------------------------+
More information about the Pyrex
mailing list