problem in compiling the module in VC2010

Discussion in 'Python' started by llwaeva@gmail.com, Jul 20, 2011.

  1. Guest

    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
    , Jul 20, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Garrett Cooper
    Replies:
    0
    Views:
    539
    Garrett Cooper
    Feb 24, 2009
  2. Garrett Cooper
    Replies:
    0
    Views:
    482
    Garrett Cooper
    Feb 24, 2009
  3. Jag
    Replies:
    5
    Views:
    304
    Paul Bibbings
    Jul 17, 2010
  4. ElMariachi
    Replies:
    0
    Views:
    417
    ElMariachi
    Sep 17, 2010
  5. sharat

    Upgrade to VC2010

    sharat, Dec 1, 2011, in forum: C++
    Replies:
    2
    Views:
    581
    Anand Hariharan
    Dec 1, 2011
Loading...

Share This Page