c++ - 无法打开 lib python。 Panda3D 项目。 VS

标签 c++ visual-studio-2010 python-2.7 panda3d

我刚刚用 Panda3D 开始了一个 C++ 项目。 ( Visual Studio 2010)

通过一个简单的 HelloWorld,我添加了路径等。没有编译错误,除了:

刚出现一个错误:

 error LNK1104: cannot open file 'python27_d.lib' 

而且我不知道如何修复它。

请帮忙!

谢谢!

最佳答案

您可以做一些事情。

1) 只在 Release模式下构建(不是一个好的解决方案,因为你不能用这种方式调试得太好)

2) 添加另一个基于“Release”但带有调试符号且没有_DEBUG 预处理器定义的构建配置(可能会弄乱一些库)

3) 使用 Visual Studio 2010 中构建的调试和发布库查找或构建 Python 2.7 版本

4) 只需更改 pyconfig.h 中的这一部分,它实际链接到 *.lib 文件以仅将 python27.lib 用于两种配置。

/* 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
#       //-----------------------change the next line-------------//
#               pragma comment(lib,"python27_d.lib") 
#           else
#               pragma comment(lib,"python27.lib")
#           endif /* _DEBUG */
#       endif /* _MSC_VER */
#   endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */

1) 2) 和 4) 是 hacky 解决方案,所以我建议您尝试使用 3)。

关于c++ - 无法打开 lib python。 Panda3D 项目。 VS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19636336/

相关文章:

c# - 将外部配置复制到 Visual Studio 中的本地项目?

python - GAE/Python - 从主类而不是从被调用的方法重定向工作

python - 安装软件包时,OS X pip 不搜索 .pypirc?

python - 在 IPython Notebook 中同时使用 Python 2.x 和 Python 3.x

c++ - QInputDialog 的样式表

c++ - 在头文件中包含一个巨大的 Vector

c++ - 为什么 glDrawPixels 在这里不起作用?

c++ - fscanf 卡在第一行

c++ - CRXIR2 不适用于 Windows 7 和 Vista 上的 VS2010

visual-studio-2010 - 无法在 Visual Studio Express 2010 中选择 Main Method 作为启动对象?