C++ calls Python Build error cannot open file 'python27_d.lib'

If you still get an error when building according to the previous steps, the error message is as follows:
fatal error LNK1104: cannot open file 'python27_d.lib'

Reason: The header file we use  <Python.h> calls "pyconfig.h"

#include "pyconfig.h"

And "python27_d.lib" is used in "pyconfig.h"

/* For an MSVC DLL, we can nominate the .lib files used by extensions */
#ifdef MS_COREDLL
# ifndef Py_BUILD_CORE /* not building the core - must be an ext */
# if defined(_MSC_VER)
/* So MSVC users need not specify the .lib file in
their Makefile (other compilers are generally
taken care of by distutils.) */
# ifdef _DEBUG
# pragma comment(lib,"python27_d.lib")
# else
# pragma comment(lib,"python27.lib")
# endif /* _DEBUG */
# endif /* _MSC_VER */
# endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */

The simpler solution is:

Please make a copy of python2 7 .lib under C:/Python2 7 /libs and rename it to python2 7 _d.lib

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324739310&siteId=291194637