Skip to content Skip to sidebar Skip to footer

How To Solve __imp___Py_NoneStruct Error In Boost.Python?

I am trying to link C++ and Python with Boost.Python. I have Visual Studio 2012 Express Version, Python 2.7, and Boost 1.54. I followed the instructions of Boost official website t

Solution 1:

The following answer tries to solve the problem

error LNK1104: cannot open file 'python27_d.lib'

_d suffix means it is searching for a debug version of the library. The Python Installation is a Release build so you cannot link your Debug Project with it.

Debug/Release

A Debug version has symbol information and generally not optimized. This version is used for debugging where as Retail Version is the version that is released.

If you are building your project in Debug Mode, it would always try to link with the debug libraries. To overcome this problem

  1. Create a release build instead of Debug. Your project would then try to link with python27.lib instead of python27_d.lib. Refer How to: Create a Release Build
  2. You can also download the Python source and build it with VS2008 (Yes, Python 2.7 is build with VS 2008). Again if you are targeting x64, you need at-least VS2008 Professional Version. This will generate python27_d.lib. Refer Python Developer’s Guide

Solution 2:

include:

  #include <python.h>

Boost doesn't have python api included... You need to build boost with python27.lib


Post a Comment for "How To Solve __imp___Py_NoneStruct Error In Boost.Python?"