LNK1104 无法打开文件“python37_d.lib”

2022/9/9 1:23:02

本文主要是介绍LNK1104 无法打开文件“python37_d.lib”,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1. 找到python头文件pyconfig.h,将 # define Py_DEBUG 注释掉(330行)

330 #ifdef _DEBUG
#define Py_DEBUG // 将该行注释掉
332 #endif

 

2.找到以下代码(287行),将 pragma comment(lib,"python37_d.lib") 修改为 pragma comment(lib,"python37.lib") ,重新编译即可。

 278 /* For an MSVC DLL, we can nominate the .lib files used by extensions */
 279 #ifdef MS_COREDLL
 280 #       if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
 281                 /* not building the core - must be an ext */
 282 #               if defined(_MSC_VER)
 283                         /* So MSVC users need not specify the .lib
 284                         file in their Makefile (other compilers are
 285                         generally taken care of by distutils.) */
 286 #                       if defined(_DEBUG)
 287 #                               pragma comment(lib,"python37_d.lib")
 288 #                       elif defined(Py_LIMITED_API)
 289 #                               pragma comment(lib,"python3.lib")
 290 #                       else
 291 #                               pragma comment(lib,"python37.lib")
 292 #                       endif /* _DEBUG */
 293 #               endif /* _MSC_VER */
 294 #       endif /* Py_BUILD_CORE */
 295 #endif /* MS_COREDLL */

 



这篇关于LNK1104 无法打开文件“python37_d.lib”的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程