Missing PyObject definition

Jeff Schwab jeff at schwabcenter.com
Mon Mar 17 11:45:16 EDT 2008


James Whetstone wrote:
> I'm trying to access a PyObject directly from C++ for the purpose of calling 
> method on a Python object that is an intance of a derived C++ class. My 
> problem is that the compiler is complaining about not PyObject not being 
> defined.  Has anyone run into the problem?  Where is PyObject defined?

Are you using Python's C API?

Did you #include "Python.h" before using PyObject?

PyObject is a C-style struct defined in object.h, which is in turn 
included by Python.h.  Does your compiler know where to look for those 
headers?  If you are getting messages of the form "error: cannot find 
Python.h," then add -Iyour_python_root/include/python2.5 (or whatever 
version) to the CXXFLAGS variable in your makefile, or to your 
compiler's command line.



More information about the Python-list mailing list