所以我在C编写一个python扩展模块,我试图编译它为我的64位Python版本。在对MinGW进行了一段时间的抨击之后,我做了一些搜索,发现MinGW不会执行64位扩展模块,所以我使用Win7 SDK和DISTUTILS_USE_SDK和MSSdk设置了Visual C++ 2008 Express,它们都等于1在this question的答案。编译python扩展模块时链接错误
我终于Distutils的找到编译器,但是当我编译扩展我得到这样的输出:
core.obj : error LNK2019: unresolved external symbol __imp__PyErr_NoMemory refer
enced in function "int __cdecl handleErrors(int)" ([email protected]@[email protected])
core.obj : error LNK2019: unresolved external symbol __imp__PyErr_SetString refe
renced in function "int __cdecl handleErrors(int)" ([email protected]@[email protected])
core.obj : error LNK2019: unresolved external symbol _opus_encoder_destroy refer
enced in function "void __cdecl OpusEncoder_dealloc(struct OpusEncoderObject *)"
([email protected]@[email protected]@@Z)
core.obj : error LNK2019: unresolved external symbol __imp__Py_BuildValue refere
nced in function "int __cdecl OpusEncoder_init(struct OpusEncoderObject *,struct
_object *,struct _object *)" ([email protected]@[email protected]@PAU_o
[email protected]@[email protected])
core.obj : error LNK2019: unresolved external symbol _opus_encoder_create refere
nced in function "int __cdecl OpusEncoder_init(struct OpusEncoderObject *,struct
_object *,struct _object *)" ([email protected]@[email protected]@PAU_o
[email protected]@[email protected])
core.obj : error LNK2019: unresolved external symbol __imp__PyArg_ParseTupleAndK
eywords referenced in function "int __cdecl OpusEncoder_init(struct OpusEncoderO
bject *,struct _object *,struct _object *)" ([email protected]@YAHPAUOpusEncode
[email protected]@[email protected]@[email protected])
core.obj : error LNK2019: unresolved external symbol __imp__PyTuple_Pack referen
ced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncoderO
bject *,struct _object *)" ([email protected]@[email protected]@PAUOpusEncoderObj
[email protected]@[email protected]@Z)
core.obj : error LNK2019: unresolved external symbol __imp__PyString_FromString
referenced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusE
ncoderObject *,struct _object *)" ([email protected]@[email protected]@PAUOpusEnc
[email protected]@[email protected]@Z)
core.obj : error LNK2019: unresolved external symbol _opus_encode_float referenc
ed in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncoderOb
ject *,struct _object *)" ([email protected]@[email protected]@PAUOpusEncoderObje
[email protected]@[email protected]@Z)
core.obj : error LNK2019: unresolved external symbol __imp__PyFloat_AsDouble ref
erenced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEnco
derObject *,struct _object *)" ([email protected]@[email protected]@PAUOpusEncode
[email protected]@[email protected]@Z)
core.obj : error LNK2019: unresolved external symbol __imp__PyType_IsSubtype ref
erenced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEnco
derObject *,struct _object *)" ([email protected]@[email protected]@PAUOpusEncode
[email protected]@[email protected]@Z)
core.obj : error LNK2019: unresolved external symbol __imp__PyFloat_Type referen
ced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncoderO
bject *,struct _object *)" ([email protected]@[email protected]@PAUOpusEncoderObj
[email protected]@[email protected]@Z)
core.obj : error LNK2019: unresolved external symbol _opus_encode referenced in
function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncoderObject *
,struct _object *)" ([email protected]@[email protected]@[email protected]@PA
[email protected]@Z)
core.obj : error LNK2019: unresolved external symbol __imp__PyErr_Occurred refer
enced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncode
rObject *,struct _object *)" ([email protected]@[email protected]@PAUOpusEncoderO
[email protected]@[email protected]@Z)
core.obj : error LNK2019: unresolved external symbol __imp__PyInt_AsLong referen
ced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEncoderO
bject *,struct _object *)" ([email protected]@[email protected]@PAUOpusEncoderObj
[email protected]@[email protected]@Z)
core.obj : error LNK2019: unresolved external symbol __imp__PyArg_ParseTuple ref
erenced in function "struct _object * __cdecl OpusEncoder_encode(struct OpusEnco
derObject *,struct _object *)" ([email protected]@[email protected]@PAUOpusEncode
[email protected]@[email protected]@Z)
core.obj : error LNK2019: unresolved external symbol __imp__PyModule_AddObject r
eferenced in function _initopys
core.obj : error LNK2019: unresolved external symbol __imp__PyErr_NewException r
eferenced in function _initopys
core.obj : error LNK2019: unresolved external symbol __imp__Py_InitModule4 refer
enced in function _initopys
core.obj : error LNK2019: unresolved external symbol __imp__PyType_Ready referen
ced in function _initopys
core.obj : error LNK2019: unresolved external symbol __imp__PyType_GenericNew re
ferenced in function _initopys
core.obj : error LNK2019: unresolved external symbol __imp__Py_Initialize refere
nced in function _main
core.obj : error LNK2019: unresolved external symbol __imp__Py_SetProgramName re
ferenced in function _main
build\lib.win-amd64-2.7\opys.pyd : fatal error LNK1120: 23 unresolved externals
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.
exe"' failed with exit status 1120
我有点敲我的头这3天,之后在这里碰了壁,任何建议?
我实际上已经与SDK编译,链接器错误是完全独立的。 – glittershark