I'm working on an application (in C++) that conditionally embeds Python. Some of the (C++) classes include PyObject*'s only when embedding Python. In other cases these aren't here. I do not want to include Python.h in the header files for these classes because not all of the clients of these classes use the Python functionality. Hence I would like to forward declare PyObject so it can be used as an opaque type in these interfaces, and only have Python.h included in those source files that actually need it. This comes up because Python.h needs to be included before any system interfaces, lest you get various compiler warnings (cf. sf issue 637321 related to the redefinition of _POSIX_C_SOURCE) but struct PyObject; doesn't work, at least in GCC 3.2.2: ../include/bt_notice.h:31: conflicting types for `struct PyObject' ../../../third-party-tools/python/include/python2.3/object.h:104: previous declaration as `typedef struct _object PyObject' make: *** [obj_g/RH72-gcc-3.2/bt_notice.o] Error 1 Since I would rather not have to include Python.h in every source file that could possible include the headers that reference PyObject*'s, I'm looking for a way to avoid these warnings. I expect there is none, but... Thanks in advance. -tree -- Tom Emerson Basis Technology Corp. Software Architect http://www.basistech.com "Beware the lollipop of mediocrity: lick it once and you suck forever"
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4