现在的位置: 首页 > 综合 > 正文

pjsip的python扩展使用

2013年11月26日 ⁄ 综合 ⁄ 共 1226字 ⁄ 字号 评论关闭

1. 在vs2005中编译python_pjsua项目会有下列错误(python2.7)

   Creating library ./output/python_pjsua-i386-win32-vc8-debug/_pjsua_d.lib and object ./output/python_pjsua-i386-win32-vc8-debug/_pjsua_d.exp
_pjsua.obj : error LNK2019: unresolved external symbol __imp___Py_Dealloc referenced in function _PyObj_pjsip_cred_info_delete
_pjsua.obj : error LNK2019: unresolved external symbol __imp___Py_NegativeRefcount referenced in function _PyObj_pjsip_cred_info_delete
_pjsua.obj : error LNK2001: unresolved external symbol __imp___Py_RefTotal
_pjsua.obj : error LNK2019: unresolved external symbol __imp__Py_InitModule4TraceRefs referenced in function _init_pjsua
../lib/_pjsua_d.pyd : fatal error LNK1120: 4 unresolved externals

主要是因为 Py_DEBUG/Py_TRACE_REFS 引起, 可以修改 Python/include 下的 pyconfig.h, object.h 两个文件。原来有个链接但好像打不开。具体修改如下:

1. 修改 pyconfig.h
修改
#ifdef _DEBUG
# define Py_DEBUG
#endif

#ifdef _DEBUG
//# define Py_DEBUG
#endif
修改
# ifdef _DEBUG
# pragma comment(lib,"python24_d.lib")
# else
# pragma comment(lib,"python24.lib")
# endif /* _DEBUG */

# ifdef _DEBUG
# pragma comment(lib,"python24.lib")
# else
# pragma comment(lib,"python24.lib")
# endif /* _DEBUG */
2. object.h
修改
#if defined(Py_DEBUG) && !defined(Py_TRACE_REFS)
#define Py_TRACE_REFS
#endif

#if defined(Py_DEBUG) && !defined(Py_TRACE_REFS)
// #define Py_TRACE_REFS
#endif

但主要也是在Debug模式下出问题,可以选为release版的

【上篇】
【下篇】

抱歉!评论已关闭.