Error Lnk2019 Unresolved External Symbol Python
Contents |
here for a quick overview of the site Help Center Detailed answers to error lnk2019 unresolved external symbol __declspec(dllimport) any questions you might have Meta Discuss the workings and c++ error lnk2019 unresolved external symbol policies of this site About Us Learn more about Stack Overflow the company Business Learn more
Error Lnk2019 Unresolved External Symbol Public
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community
Error Lnk2019 Unresolved External Symbol Winmain@16 Referenced In Function ___tmaincrtstartup
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Unresolved external symbols building Python C extension up vote 0 down vote favorite I'm currently trying to build a C-extension in Windows. The errors seem related to error lnk2019 unresolved external symbol visual studio 2010 not finding 'standard' symbols in the python27.dll. How do I resolve these missing symbols? Do I need to somehow tell the compiler where to find python27.dll or is something wrong with my python27.lib? My setup is the following: Windows 7 64-bit Python 2.7.4 Numpy 1.7 Swig 2.0.9 Visual studio 9.0 I found this link that seems to have a related problem, but with versions of things I'm not using: http://bugs.python.org/issue15772 I'm running python setup.py build_ext --inplace to build the extension. The setup.py looks like the following: try: numpy_include = numpy.get_include() except AttributeError: numpy_include = numpy.get_numpy_include() fmm3d_module = Extension('_fmm3d', sources=['fmm3d.i', 'fmm3d.c'], include_dirs = [numpy_include]) Everything compiles fine and then runs the following link command: C:\Program Files (x86)\Microsoft Visual Studio 9.\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\ amd64 /EXPORT:init_fmm3d build\temp.win-amd64-2.7\Release\fmm3d_wrap.obj build\temp.win-amd64-2.7\Release\fmm3d.obj /OUT:C:\Users\luke\Documents\Ranking\code\_fmm3d.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\_fmm3d.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\_fmm3d.pyd.manifest I get link errors that relate to Python symbols like the following: fmm3d_wrap.obj : error LNK2019: unresolved external symbol __imp__PyString_AsString re
isn't used? Next message (by thread): Help configuring visual studio to compile python extensions Messages
Error Lnk2019 Unresolved External Symbol Public __thiscall Referenced In Function _main
sorted by: [ date ] [ thread ] [ subject error lnk2019 unresolved external symbol void __cdecl ] [ author ] I've installed Microsoft Visual Studio 10.0. Here are the steps I've error lnk2019 unresolved external symbol main referenced in function __tmaincrtstartup been taking. My python version is Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:16:31) [MSC v.1600 64 bit (AMD64)] on win32. (Sorry for the long output.) http://stackoverflow.com/questions/24024867/unresolved-external-symbols-building-python-c-extension >cd "c:\Program Files (x86)\Microsoft Visual Studio 10.0"\vc >vcvarsall.bat > >SET VS90COMNTOOLS=%VS100COMNTOOLS% c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>pip install scandir Collecting scandir Using cached scandir-0.9.tar.gz Installing collected packages: scandir Running setup.py install for scandir building '_scandir' extension C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python34\include https://mail.python.org/pipermail/python-list/2015-January/683721.html -Ic:\Python34\include /Tc_scandir.c /Fobuild\temp.win-amd64-3.4\Release \_scandir.obj _scandir.c C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\Python34\libs /LIBPATH:c:\Python34\PCbuild\amd64 /EXPORT:PyInit__scandir build\temp.win -amd64-3.4\Release\_scandir.obj /OUT:build\lib.win-amd64-3.4\_scandir.pyd /IMPLIB:build\temp.win-amd64-3.4\Release\_scandir.lib /MANIFESTFILE:build\temp.win-amd64-3.4\Release\_scandir.pyd.manifest Creating library build\temp.win-amd64-3.4\Release\_scandir.lib and object build\temp.win-amd64-3.4\Release\_scandir.exp _scandir.obj : error LNK2001: unresolved external symbol _PyObject_SelfIter _scandir.obj : error LNK2001: unresolved external symbol _PyObject_GenericGetAttr _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_WarnEx referenced in function _win32_warn_bytes_api _scandir.obj : error LNK2019: unresolved external symbol __imp__PyExc_DeprecationWarning referenced in function _win32_warn_bytes_api _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_Occurred referenced in function _path_converter _scandir.obj : error LNK2019: unresolved external symbol __imp__PyBytes_FromObject referenced in function _path_converter _scandir.obj : error LNK2019: unresolved external symbol __imp__PyErr_Clear referenced in function _path_converter _scandir.obj : error LNK2019: unresolved external symbol __imp__PyExc_ValueError referenced in function _path_converter _scandir.obj : error LNK2019: unresolved external symbol __imp__PyUnicode_AsUnicodeAndSize referenced in function _path_converter _scandir.obj : error LNK2019: unresolved external symbol __imp__PyUnicode_FromObject referenced in function _path_converter _scandir.obj : error LNK2019: unresolved external symbol __imp
Actions: ------------------------ ------------------------ Rename Page Delete Page ------------------------ Subscribe User ------------------------ Remove Spam Revert to this revision Table of Contents Contents Table of Contents https://scipy.github.io/old-wiki/pages/Cookbook/C_Extensions.html Skeleton Debugging C Extensions on Windows Valgrind Documentation Examples Mailing List Threads Skeleton extmodule.h: 1 #ifndef EXTMODULE_H 2 #define EXTMODULE_H 3 4 #ifdef __cplusplus http://bugs.nuitka.net/issue106 5 extern "C" { 6 #endif 7 8 /* Python.h must be included before everything else */ 9 #include "Python.h" 10 11 /* error lnk2019 include system headers here */ 12 13 #if !defined(EXTMODULE_IMPORT_ARRAY) 14 #define NO_IMPORT_ARRAY 15 #endif 16 #include "numpy/arrayobject.h" 17 18 #ifdef __cplusplus 19 } 20 #endif 21 22 #endif 23 Note that PY_ARRAY_UNIQUE_SYMBOL must be set to a unique value for each extension module. But, you actually don't error lnk2019 unresolved need to set it at all unless you are going to compile an extension module that uses two different source files extmodule.c: 1 #define EXTMODULE_IMPORT_ARRAY 2 #include "extmodule.h" 3 #undef EXTMODULE_IMPORT_ARRAY 4 5 static PyObject* FooError; 6 7 static PyObject* Ext_Foo(PyObject* obj, PyObject* args) { 8 Py_INCREF(Py_None); 9 return Py_None; 10 } 11 12 static PyMethodDef methods[] = { 13 {"foo", (PyCFunction) Ext_Foo, METH_VARARGS, ""}, 14 {NULL, NULL, 0, NULL} 15 }; 16 17 PyMODINIT_FUNC init_extmodule() { 18 PyObject* m; 19 m = Py_InitModule("_extmodule", methods); 20 import_array(); 21 SVMError = PyErr_NewException("_extmodule.FooError", NULL, NULL); 22 Py_INCREF(FooError); 23 PyModule_AddObject(m, "FooError", FooError); 24 } If your extension module is contained in a single source file then you can get rid of extmodule.h entirely and replace the first part of extmodule.c with 1 #inlude "Python.h" 2 #include "numpy/arrayobject.h" 3 4 /* remainder of extmodul
compiler_crash, windows Created on 2013-09-25.08:51:18 by yaroslav, last changed by kayhayen. Messages msg438 (view) Author: kayhayen Date: 2013-09-30.10:06:52 I believe you are mixing 32 bits compiler with 64 bits Python or vice versa.For that there already is an issue I think, thus resolving this. msg437 (view) Author: yaroslav Date: 2013-09-30.10:02:37 The problem with path now seems to be fixed, thanks a lot. However there are problems on link stage. Here is the end of the error log, when i do simple "nuitka-python test.py": InspectPatcher.obj : error LNK2019: unresolved external symbol __imp_PyCFunction_NewEx referenced in function "void __cdecl patchInspectModule(void)" (?patchInspectModule@@YAXXZ) InspectPatcher.obj : error LNK2019: unresolved external symbol __imp_Py_NoSiteFlag referenced in function "void __cdecl patchInspectModule(void)" (?patchInspectModule@@YAXXZ) module.__main__.obj : error LNK2001: unresolved external symbol __imp_Py_NoSiteFlag module.__main__.obj : error LNK2019: unresolved external symbol __imp_Py_InitModule4_64 referenced in function "void __cdecl init__main__(void)" (?init__main__@@YAXXZ) module.__main__.obj : error LNK2019: unresolved external symbol __imp_Py_Exit referenced in function main module.__main__.obj : error LNK2019: unresolved external symbol __imp_PyErr_PrintEx referenced in function main module.__main__.obj : error LNK2019: unresolved external symbol __imp_PySys_SetObject referenced in function main module.__main__.obj : error LNK2019: unresolved external symbol __imp_Py_Initialize referenced in function main module.__main__.obj : error LNK2019: unresolved external symbol __imp_Py_BytesWarningFlag referenced in function main module.__main__.obj : error LNK2019: unresolved external symbol __imp_Py_VerboseFlag referenced in function main module.__main__.obj : error LNK