[C++-sig] compile problem

Paul F. Kunz Paul_Kunz at SLAC.Stanford.EDU
Sat Aug 3 15:50:24 CEST 2002

   The following code...

python::ref TClassWrap_instantiate_raw( PyObject * aTuple, PyObject * aDict )
  PyObject* self = PyTuple_GetItem(aTuple, 0);
  TClassWrap* cw = BOOST_PYTHON_CONVERSION::from_python( self,python::type<TClassWrap*>());
  PyObject * obj = cw->m_constructor->invoke(aTuple, aDict);
  python::ref r = obj;
  return r;
does not compile with gcc 3.1.1, but does compile with gcc 2.95.3 and
VC++ 6 sp5.   The gcc 3.1.1 error message is

/usr/local/test/bin/c++ -DHAVE_CONFIG_H -I. -I../../../RootPython/src/RootModule -I../.. -I../../../RootPython -I/usr/local/test/boost -I/usr/local/include/python2.1 -I/usr/local/root/include -g -O2 -Wall -Wp,-MD,.deps/TClassWrap.pp -c ../../../RootPython/src/RootModule/TClassWrap.cpp  -fPIC -DPIC
../../../RootPython/src/RootModule/TClassWrap.cpp: In function 
   `boost::python::ref TClassWrap_instantiate_raw(PyObject*, PyObject*)':
../../../RootPython/src/RootModule/TClassWrap.cpp:57: conversion from `
   PyObject*' to non-scalar type `boost::python::reference<PyObject>' requested

I'm confused.  Any hints?

More information about the Cplusplus-sig mailing list