problem in compiling the module in VC2010

llwaeva at gmail.com llwaeva at gmail.com
Wed Jul 20 17:33:41 CEST 2011


Hi all,
  I am compiling the example with MCVS2010

#include "Python.h"

static PyObject *
ex_foo(PyObject *self, PyObject *args)
{
    printf("Hello, world\n");
    Py_INCREF(Py_None);
    return Py_None;
}

static PyMethodDef example_methods[] = {
    {"foo", ex_foo, METH_VARARGS, "foo() doc string"},
    {NULL, NULL}
};

static struct PyModuleDef examplemodule = {
    PyModuleDef_HEAD_INIT,
    "example",
    "example module doc string",
    -1,
    example_methods,
    NULL,
    NULL,
    NULL,
    NULL
};

PyMODINIT_FUNC
PyInit_example(void)
{
    return PyModule_Create(&examplemodule);
}


But it reports the following message:

error LNK2001: unresolved external symbol __imp___Py_NoneStruct
error LNK2019: unresolved external symbol __imp__PyModule_Create2
referenced in function _PyInit_example

My os is windows 7 64-bit. Compiler: VC2010






More information about the Python-list mailing list