2006年10月19日 星期四 13:27
我用gcc就出一堆的错误,不知为什么? g++是好的。 gcc testpy.C -export-dynamic -I/usr/include/python2.2 -L/usr/lib/python2.2/config -lpython2.2 -lpthread -ldl -lutil .. /tmp/ccMETLWb.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' /usr/lib/python2.2/config/libpython2.2.a(floatobject.o)(.text+0x1359): In funct: : undefined reference to `pow' .. /usr/lib/python2.2/config/libpython2.2.a(complexobject.o)(.text+0x3f7): In func: : undefined reference to `log' collect2: ld returned 1 exit status make: *** [phony] Error 1 加上 -lm后还剩一个错误,不知还要添哪个库? 为什么g++不用显式-lm? gcc testpy.C -export-dynamic -I/usr/include/python2.2 -L/usr/lib/python2.2/config -lpython2.2 -lpthread -ldl -lutil -lm .. /tmp/ccQrgkmD.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status make: *** [phony] Error 1 testPython.C 源代码如下:(并没有用到std呀?) #include#include #include int main(int argc, char* argv[]) { Py_Initialize(); PyRun_SimpleString("import time\nprint time.ctime(time.time())"); Py_Finalize(); return 0; } ======== 2006-10-19 12:10:00 您在来信中写道: ======== linux下不按文件名识别属性, 这个程序是典型的C 编译: g++ Pytest.cpp -o Pytest -I/usr/include/python2.4 -L/usr/lib/ -lpython2.4 gcc Pytest.cpp -o Pytest -I/usr/include/python2.4 -L/usr/lib/ -lpython2.4 我的环境都可以 -- Jia LU < http://www.lujia.us> python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '001akor at liamg.moc'.split('@')])" -- \ "Unix is an operating system, OS/2 is half an operating system, | `\ Windows is a shell, and DOS is a boot partition virus." -- | _o__) Peter H. Coffin | = = = = = = = = = = = = = = = = = = = = = = 致 礼! Jin Qing jinq0123 at 163.com 2006-10-19
Zeuux © 2025
京ICP备05028076号