|
Re: Can't get a simple example with fstream to compile & link: msg#00134python.c++
Opps, I messed up when cutting and pasting my example out of a larger sample. The constructor shouldn't start to initialize variables and should read: PythonWrapper(int id) { myid = id; }; Sorry! --- Fast Bike <cdn_pride@xxxxxxxxx> wrote: > I have been trying this for a little while. I can do > simple examples, but when I try to do something a > little more complex I get litany of errors. > > For example creating a simple class that uses an > instance of fstream seems to give me trouble. > > Example: > class PythonWrapper > { > public: > PythonWrapper(int id) : { myid = id; }; > private: > int myid; > std::fstream myfile; > }; > > BOOST_PYTHON_MODULE(PythonWrapper) > { > using namespace boost::python; > > scope x_class = > class_<PythonWrapper>("PythonWrapper", > init<int>()) > > ; > > } > > Gives me: > /usr/local/gcc_3.2/bin/g++ -c -DOTL_ODBC_UNIX > -DOTL_STL -DOTL_ANSI_CPP -DOTL_STREAM_POOLING_ON > PrintFileStats/PythonWrapp > er.cpp -I/home/kstrauss/boost/boost_1_30_0 > -I/usr/local/python-2.2/include/python2.2 > PrintFileStats/PythonWrapper.cpp: In constructor > `PythonWrapper::PythonWrapper(int)': > PrintFileStats/PythonWrapper.cpp:21: no base or > member > initializers given > following ':' > /usr/local/gcc_3.2/include/c++/3.2.2/bits/ios_base.h: > In copy constructor > `std::basic_ios<char, std::char_traits<char> > >::basic_ios(const > std::basic_ios<char, std::char_traits<char> >&)': > /home/kstrauss/boost/boost_1_30_0/boost/python/object/value_holder.hpp:111: > instantiated from `boost::python::objects:: > value_holder<Held>::value_holder(PyObject*, A0) > [with > A0 = boost::reference_wrapper<const PythonWrapper>, > Held = PythonWr > apper]' > /home/kstrauss/boost/boost_1_30_0/boost/python/object/make_instance.hpp:64: > instantiated from `static Holder* boost::py > thon::objects::make_instance<T, > Holder>::construct(void*, PyObject*, > boost::reference_wrapper<const T>) [with T = PythonW > rapper, Holder = > boost::python::objects::value_holder<PythonWrapper>]' > /home/kstrauss/boost/boost_1_30_0/boost/python/object/make_instance.hpp:38: > instantiated from `static PyObject* boost:: > python::objects::make_instance_impl<T, Holder, > Derived>::execute(Arg&) [with Arg = const > boost::reference_wrapper<const P > ythonWrapper>, T = PythonWrapper, Holder = > boost::python::objects::value_holder<PythonWrapper>, > Derived = boost::python:: > objects::make_instance<PythonWrapper, > boost::python::objects::value_holder<PythonWrapper> > >]' > /home/kstrauss/boost/boost_1_30_0/boost/python/object/class_wrapper.hpp:27: > instantiated from `static PyObject* boost:: > python::objects::class_cref_wrapper<Src, > MakeInstance>::convert(const Src&) [with Src = > PythonWrapper, MakeInstance = boo > st::python::objects::make_instance<PythonWrapper, > boost::python::objects::value_holder<PythonWrapper> > >]' > /home/kstrauss/boost/boost_1_30_0/boost/python/converter/as_to_python_function.hpp:31: > instantiated from `static PyObje > ct* > boost::python::converter::as_to_python_function<T, > ToPython>::convert(const void*) [with T = > PythonWrapper, ToPython > = > boost::python::objects::class_cref_wrapper<PythonWrapper, > boost::python::objects::make_instance<PythonWrapper, > boost::p > ython::objects::value_holder<PythonWrapper> > >]' > /home/kstrauss/boost/boost_1_30_0/boost/python/to_python_converter.hpp:32: > instantiated from `boost::python::to_python_ > converter<T, Conversion>::to_python_converter() > [with > T = PythonWrapper, Conversion = > boost::python::objects::class_cref_ > wrapper<PythonWrapper, > boost::python::objects::make_instance<PythonWrapper, > boost::python::objects::value_holder<PythonWr > apper> > >]' > /home/kstrauss/boost/boost_1_30_0/boost/python/class.hpp:90: > instantiated from `void > boost::python::detail::register_cl > ass_to_python(boost::mpl::bool_<true>, SelectHolder, > T*) [with T = PythonWrapper, SelectHolder = > boost::python::objects:: > detail::select_value_holder<PythonWrapper, > PythonWrapper>]' > /home/kstrauss/boost/boost_1_30_0/boost/python/class.hpp:478: > instantiated from `void boost::python::class_<T, > X1, > X2, > X3>::register_() const [with T = PythonWrapper, X1 = > boost::python::detail::not_specified, X2 = > boost::python::detail::no > t_specified, X3 = > boost::python::detail::not_specified]' > /home/kstrauss/boost/boost_1_30_0/boost/python/class.hpp:215: > instantiated from `boost::python::class_<T, X1, > X2, > X3>:: > class_(const char*, const > boost::python::init_base<DerivedT>&) [with DerivedT > = > boost::python::init<int, boost::mpl::void > _, boost::mpl::void_, boost::mpl::void_, > boost::mpl::void_, boost::mpl::void_, > boost::mpl::void_, boost::mpl::void_, boos > t::mpl::void_, boost::mpl::void_, boost::mpl::void_, > boost::mpl::void_, boost::mpl::void_, > boost::mpl::void_, boost::mpl: > :void_>, T = PythonWrapper, X1 = > boost::python::detail::not_specified, X2 = > boost::python::detail::not_specified, X3 = bo > ost::python::detail::not_specified]' > PrintFileStats/PythonWrapper.cpp:48: instantiated > from here > /usr/local/gcc_3.2/include/c++/3.2.2/bits/ios_base.h:424: > ` > std::ios_base::ios_base(const std::ios_base&)' is > private > /home/kstrauss/boost/boost_1_30_0/boost/python/object/value_holder.hpp:111: > within > this context > /usr/local/gcc_3.2/include/c++/3.2.2/streambuf: In > copy constructor > `std::basic_filebuf<char, std::char_traits<char> > >::basic_filebuf(const > std::basic_filebuf<char, std::char_traits<char> > >&)': > /usr/local/gcc_3.2/include/c++/3.2.2/streambuf:479: > ` > std::basic_streambuf<_CharT, > _Traits>::basic_streambuf(const > std::basic_streambuf<_CharT, _Traits>&) [with > _CharT = char, _Traits = > std::char_traits<char>]' is private > /home/kstrauss/boost/boost_1_30_0/boost/python/object/value_holder.hpp:111: > within > this context > make: *** [PythonWrapper.o] Error 1 > > Obviously I'm missing something in the overall > concept > here. Anybody willing to give me a hand? > > Thx > > Karl > > > __________________________________ > Do you Yahoo!? > The New Yahoo! Search - Faster. Easier. Bingo. > http://search.yahoo.com > > _______________________________________________ > C++-sig mailing list > C++-sig@xxxxxxxxxx > http://mail.python.org/mailman/listinfo/c++-sig __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Can't get a simple example with fstream to compile & link: 00134, Fast Bike |
|---|---|
| Next by Date: | Re: Can't get a simple example with fstream to compile & link: 00134, Stefan Seefeld |
| Previous by Thread: | Can't get a simple example with fstream to compile & linki: 00134, Fast Bike |
| Next by Thread: | Re: Can't get a simple example with fstream to compile & link: 00134, Stefan Seefeld |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |