Link your C++ module with Python27.lib .

Boost.Python is only the wrapper of Python binding so if your module is static, it absolutely needs the Python27.lib . Even we might use dynamic boost.python , but host application might still require Python27.lib if there are any Python APIs called.

On Tue, May 30, 2017 at 3:01 PM, Gavin Lambert via Boost-users <> wrote:
On 25/05/2017 15:01, Heng Zhou wrote:
(5) Build under x64 configuration and got  errors:
1>Source.obj : error LNK2001: unresolved external symbol __imp_PyString_Type
1>Source.obj : error LNK2001: unresolved external symbol __imp__Py_NoneStruct
1>C:\...\ConsoleApplication1\x64\Release\ConsoleApplication1.dll : fatal error LNK1120: 2 unresolved externals

I have no idea what the matter is. I will greatly appreciate it if you can help me out.

I don't use Boost.Python myself so I can't give you more specific instructions, but unresolved externals of __imp_* symbols mean that you need to add an import library (the .lib) for a DLL, either by adding a reference to it or by adding it to the linker project settings.

Given the names of the symbols, it's most likely one of the Python runtime DLLs.

Boost-users mailing list