thanks.I completed it...this is orther problem.The above code is
correct.Thanks for you...
2012/11/18 Holger Brandsmeier
> That error has nothing to do with boost python. Apparently you did not
> link against the definition for the class Rectangle. You need to link
> against the object file
http://stackoverflow.com/questions/4331599/calling-python-functions-from-c This
a simple problem.But they are not the same.My problem is:
boost::python::object func;
Rectangle ret;
func(&ret); // How to make a parameter of c++ instance's pointer to a
python function.
2012/11/18 Holger Brands
That error has nothing to do with boost python. Apparently you did not
link against the definition for the class Rectangle. You need to link
against the object file generated from the definiton of Rectangle,
usually you would have a Rectangle.cpp and generate a Rectangle.o.
Your python module needs
I have write more code.what documentation? http://www.boost.org/? Looks
some confused.I have not found the description of this problem.
BOOST_PYTHON_MODULE(ctopython)
{
using namespace boost::python;
class_ ("Rectangle")
.def("area",&Rectangle::area)
;
def("runtest",runtes
yes..I try it..
Error:undefined symbol:_ZRI9Rectangle
2012/11/17 Sybren A. Stüvel
>
> On 17 November 2012 16:46, simon zhang wrote:
>
>> > func( &rt );
>> How to make a parameter of c++ instance's pointer to a python function.
>>
>> > def pfunc( ret )
>> > print ret.long
>> > print ret.
Have a look at
http://stackoverflow.com/questions/4331599/calling-python-functions-from-c
On Sat, Nov 17, 2012 at 4:25 PM, simon zhang wrote:
> This is a complex problem. I provide some code.
>
> c++
> ===
> #include
> #include
> #include
>
> class Rectangle
On 17 November 2012 16:46, simon zhang wrote:
> > func( &rt );
> How to make a parameter of c++ instance's pointer to a python function.
>
> > def pfunc( ret )
> > print ret.long
> > print ret.area()
> How to use c++ instance in python code.
> parameter
>
Have you tried what you coded a
> func( &rt );
How to make a parameter of c++ instance's pointer to a python function.
> def pfunc( ret )
> print ret.long
> print ret.area()
How to use c++ instance in python code.
parameter
2012/11/17 Sybren A. Stüvel
> On 17 November 2012 16:25, simon zhang wrote:
>
>> how to do?
>>
On 17 November 2012 16:25, simon zhang wrote:
> how to do?
>
So... what's your question exactly?
--
Sybren A. Stüvel
http://stuvel.eu/
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
This is a complex problem. I provide some code.
c++
===
#include
#include
#include
class Rectangle {
public:
Rectangle();
virtual ~Rectangle();
void set(int lg,int wd) { long=lg; width=wd; };
int area() { return long*width; } ;
int long;
10 matches
Mail list logo