Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9975

problem in compiling the module in VC2010

Date 2011-07-20 23:33 +0800
From llwaeva@gmail.com
Subject problem in compiling the module in VC2010
Newsgroups comp.lang.python
Message-ID <mailman.1299.1311176026.1164.python-list@python.org> (permalink)

Show all headers | View raw


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


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

problem in compiling the module in VC2010 llwaeva@gmail.com - 2011-07-20 23:33 +0800

csiph-web