2007年10月22日 星期一 17:58
ÓÐÓÃ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
2007年10月22日 星期一 18:17
将现有的移植, 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
2007年10月22日 星期一 23:40
ÊÇÉÙÁ˶«Î÷°¡,µ«ÊÇÔõô»áÕâÑùÁÐ?¿Ï¶¨ÊÇÄĸöµØ·½Ã»ÓÐÅäÖúÃ,ËÅä¹ýÕâÌ׶«¶«µÄ,Âé·³Ö¸µãÒ»ÏÂŶ! ÔÚ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
2007年10月23日 星期二 08:26
¾²Ì¬¿âû¼ÓÈë½øÈ¥°É ----- 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
Zeuux © 2025
京ICP备05028076号