Python论坛  - 讨论区

标题:[python-chinese] 有人用boost.python的吗?

2007年10月22日 星期一 17:58

Joe Simer simerjoe在gmail.com
星期一 十月 22 17:58:49 HKT 2007

ÓÐÓÃboost.pythonµÄÂð?ÎÒÒÔÇ°ÓÐЩc++µÄ´úÂë,Ïë°ÑËüÃÇ×ö³ÉpythonÄ£¿é,µ«ÊǸտªÊ¼¾ÍÓöµ½À§ÄÑÁË,boost.pythonÔõô¶¼µ÷ÊÔ²»ºÃ.
ÎÒÔÚxpÏ¿ª·¢,ÓõÄMingw+Eclipse
ÔÚEclipseÖÐÒýÈëc:\python25 ºÍ d:\boostÒÔºó,ÔÚ±àÒëµÄʱºò³ö´í:
Ô´Âë:

#include 
#include python.hpp>

using namespace std;
using namespace boost::python;

int main()
{
 cout << "CPP print Hello World!!!"<< endl; / prints Hello World!!!
 return 0;
}



´íÎóÐÅÏ¢:

**** Build of configuration Debug for project HelloWorld ****

**** Internal Builder is used for build               ****
g++ -LD:\boost -oHelloWorld.exe src\HelloWorld.o
src\HelloWorld.o(.text$_ZN5boost6python3api6objectC2Ev+0xe): In function
`ZN5boost6python6detail11upcast_implI7_objectS3_EEPT0_PT_S5_':
D:/boost/boost/python/cast.hpp: undefined reference to
`_imp___Py_NoneStruct'
Build error occurred, build is stopped
Time consumed: 1375  ms.



¸÷λţÈË,Ë­°ï°ïÎÒ!
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071022/f82082f5/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月22日 星期一 18:17

Alec huanghao.c在gmail.com
星期一 十月 22 18:17:41 HKT 2007

将现有的移植, swig 是最好的办法(www.swig.org)

用 boost::python 你要重写很多。

从报错信息来看

貌似是少链接了某些东西。

"undefined reference to `_imp___Py_NoneStruct'"


Joe Simer 写道:
> 有用boost.python的吗?我以前有些c++的代码,想把它们做成python模块,但是刚
> 开始就遇到困难了, boost.python怎么都调试不好.
> 我在xp下开发,用的Mingw+Eclipse
> 在Eclipse中引入c:\python25 和 d:\boost以后,在编译的时候出错:
> 源码:
>
> #include 
> #include python.hpp>
<i>>
> using namespace std;
> using namespace boost::python;
>
> int main()
> {
> cout << "CPP print Hello World!!!"<< endl; // prints Hello World!!!
> return 0;
> }
>
> 错误信息:
>
> **** Build of configuration Debug for project HelloWorld ****
>
> **** Internal Builder is used for build ****
> g++ -LD:\boost -oHelloWorld.exe src\HelloWorld.o
> src\HelloWorld.o(.text$_ZN5boost6python3api6objectC2Ev+0xe): In
> function `ZN5boost6python6detail11upcast_implI7_objectS3_EEPT0_PT_S5_':
> D:/boost/boost/python/cast.hpp: undefined reference to
> `_imp___Py_NoneStruct'
> Build error occurred, build is stopped
> Time consumed: 1375 ms.
>
> 各位牛人,谁帮帮我!
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月22日 星期一 23:40

Joe Simer simerjoe在gmail.com
星期一 十月 22 23:40:45 HKT 2007

ÊÇÉÙÁ˶«Î÷°¡,µ«ÊÇÔõô»áÕâÑùÁÐ?¿Ï¶¨ÊÇÄĸöµØ·½Ã»ÓÐÅäÖúÃ,Ë­Åä¹ýÕâÌ׶«¶«µÄ,Âé·³Ö¸µãÒ»ÏÂŶ!

ÔÚ07-10-22£¬Alec <huanghao.c在gmail.com> дµÀ£º
>
> ½«ÏÖÓеÄÒÆÖ²£¬ swig ÊÇ×îºÃµÄ°ì·¨(www.swig.org)
>
> Óà boost::python ÄãÒªÖØдºÜ¶à¡£
>
> ´Ó±¨´íÐÅÏ¢À´¿´
>
> òËÆÊÇÉÙÁ´½ÓÁËijЩ¶«Î÷¡£
>
> "undefined reference to `_imp___Py_NoneStruct'"
>
>
> Joe Simer дµÀ:
> > ÓÐÓÃboost.pythonµÄÂð?ÎÒÒÔÇ°ÓÐЩc++µÄ´úÂë,Ïë°ÑËüÃÇ×ö³ÉpythonÄ£¿é,µ«ÊǸÕ
> > ¿ªÊ¼¾ÍÓöµ½À§ÄÑÁË, boost.pythonÔõô¶¼µ÷ÊÔ²»ºÃ.
> > ÎÒÔÚxpÏ¿ª·¢,ÓõÄMingw+Eclipse
> > ÔÚEclipseÖÐÒýÈëc:\python25 ºÍ d:\boostÒÔºó,ÔÚ±àÒëµÄʱºò³ö´í:
> > Ô´Âë:
> >
> > #include 
> > #include python.hpp>
<i>> >
> > using namespace std;
> > using namespace boost::python;
> >
> > int main()
> > {
> > cout << "CPP print Hello World!!!"<< endl; // prints Hello World!!!
> > return 0;
> > }
> >
> > ´íÎóÐÅÏ¢:
> >
> > **** Build of configuration Debug for project HelloWorld ****
> >
> > **** Internal Builder is used for build ****
> > g++ -LD:\boost -oHelloWorld.exe src\HelloWorld.o
> > src\HelloWorld.o(.text$_ZN5boost6python3api6objectC2Ev+0xe): In
> > function `ZN5boost6python6detail11upcast_implI7_objectS3_EEPT0_PT_S5_':
> > D:/boost/boost/python/cast.hpp: undefined reference to
> > `_imp___Py_NoneStruct'
> > Build error occurred, build is stopped
> > Time consumed: 1375 ms.
> >
> > ¸÷λţÈË,Ë­°ï°ïÎÒ!
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071022/e8b9f76d/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月23日 星期二 08:26

xuanll xuanll在zctt.com.cn
星期二 十月 23 08:26:11 HKT 2007

¾²Ì¬¿âû¼ÓÈë½øÈ¥°É

  ----- Original Message ----- 
  From: Joe Simer 
  To: huanghao.c在gmail.com ; python-chinese在lists.python.cn 
  Sent: Monday, October 22, 2007 11:40 PM
  Subject: Re: [python-chinese] ÓÐÈËÓÃboost.pythonµÄÂð?


  ÊÇÉÙÁ˶«Î÷°¡,µ«ÊÇÔõô»áÕâÑùÁÐ?¿Ï¶¨ÊÇÄĸöµØ·½Ã»ÓÐÅäÖúÃ,Ë­Åä¹ýÕâÌ׶«¶«µÄ,Âé·³Ö¸µãÒ»ÏÂŶ!


  ÔÚ07-10-22£¬Alec <huanghao.c在gmail.com> дµÀ£º 
    ½«ÏÖÓеÄÒÆÖ²£¬ swig ÊÇ×îºÃµÄ°ì·¨(www.swig.org)

    Óà boost::python ÄãÒªÖØдºÜ¶à¡£

    ´Ó±¨´íÐÅÏ¢À´¿´

    òËÆÊÇÉÙÁ´½ÓÁËijЩ¶«Î÷¡£

    "undefined reference to `_imp___Py_NoneStruct'"


    Joe Simer дµÀ:
    > ÓÐÓÃboost.pythonµÄÂð?ÎÒÒÔÇ°ÓÐЩc++µÄ´úÂë,Ïë°ÑËüÃÇ×ö³ÉpythonÄ£¿é,µ«ÊǸÕ
    > ¿ªÊ¼¾ÍÓöµ½À§ÄÑÁË, boost.pythonÔõô¶¼µ÷ÊÔ²»ºÃ.
    > ÎÒÔÚxpÏ¿ª·¢,ÓõÄMingw+Eclipse 
    > ÔÚEclipseÖÐÒýÈëc:\python25 ºÍ d:\boostÒÔºó,ÔÚ±àÒëµÄʱºò³ö´í:
    > Ô´Âë:
    >
    > #include 
    > #include python.hpp>
    >
    > using namespace std;
    > using namespace boost::python; 
    >
    > int main()
    > {
    > cout << "CPP print Hello World!!!"<< endl; / prints Hello World!!!
    > return 0;
    > }
    >
    > ´íÎóÐÅÏ¢:
    >
    > **** Build of configuration Debug for project HelloWorld **** 
    >
    > **** Internal Builder is used for build ****
    > g++ -LD:\boost -oHelloWorld.exe src\HelloWorld.o
    > src\HelloWorld.o(.text$_ZN5boost6python3api6objectC2Ev+0xe): In
    > function `ZN5boost6python6detail11upcast_implI7_objectS3_EEPT0_PT_S5_': 
    > D:/boost/boost/python/cast.hpp: undefined reference to
    > `_imp___Py_NoneStruct'
    > Build error occurred, build is stopped
    > Time consumed: 1375 ms.
    >
    > ¸÷λţÈË,Ë­°ï°ïÎÒ!
    >
    > ------------------------------------------------------------------------ 
    >
    > _______________________________________________
    > python-chinese
    > Post: send python-chinese在lists.python.cn
    > Subscribe: send subscribe to python-chinese-request在lists.python.cn
    > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn 
    > Detail Info: http://python.cn/mailman/listinfo/python-chinese

    _______________________________________________
    python-chinese
    Post: send python-chinese在lists.python.cn
    Subscribe: send subscribe to python-chinese-request在lists.python.cn
    Unsubscribe: send unsubscribe to   python-chinese-request在lists.python.cn
    Detail Info: http://python.cn/mailman/listinfo/python-chinese 




------------------------------------------------------------------------------


  _______________________________________________
  python-chinese
  Post: send python-chinese在lists.python.cn
  Subscribe: send subscribe to python-chinese-request在lists.python.cn
  Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
  Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071023/c0196687/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号