pjsip的python扩展使用
2011-05-24 01:40
399 查看
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版的
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版的
相关文章推荐
- 如何使用C来扩展python功能。
- 使用C语言扩展Python(三)
- 使用Pyrex来扩展和加速Python程序的教程
- 使用C++扩展Python的功能
- 零基础学python-13.4 文件上使用列表解析与列表解析扩展
- python27 mysql win7扩展安装 使用
- [zz]通过win32扩展接口使用 Python获得系统进程列表的方法
- 使用.pth文件扩展python环境路径
- java 中使用 python外部扩展包pycha
- ArcGIS应用——使用Python为图斑连续编号及扩展应用
- 转)使用C/C++扩展Python
- 使用C语言扩展Python(一)
- 在Python扩展中使用MFC
- 使用C语言扩展Python(四)
- 使用vs2008实现C语言对Python2的扩展
- windows 下 使用codeblocks 实现C语言对python的扩展
- 使用MinGW 编译python扩展模块
- 使用C语言扩展Python(一)
- 使用C语言扩展Python(五)
- 使用c/c++扩展python