LINK : fatal error LNK1104: cannot open file 'python37_d.lib'

Viewed 7160

I was trying to integrate Python interpreter in C++ application in Visual Studio 2013, despite of adding INCLUDES and ENV VARIABLES such as LIB & LIBPATH, compilation is throwing an Error as

LINK : fatal error LNK1104: cannot open file 'python37_d.lib'.

I tried all possible google suggestions, but still I am not able get rid of this Error. Any help on this would be highly appreciated.

2 Answers

This library is intended for debugging, and you simply don't have it if the Python was installed with default options. To obtain it, you are to (re)install Python with "Download debug binaries" option enabled in the installer. Then the python37_d.lib will be located in %PythonPath%\Libs together with python3_d.lib.

Following up the Suthiro's answer, you can also explicitly specify Debug or Release configurations for multi-configuration generators (Ninja Multi-Config, Visual Studio) by running

# Configure the build
cmake -S . -B build

# Actually build the binaries
cmake --build build --config Release

in your source directory. For single configuration generators and more details see this answer https://stackoverflow.com/a/64719718/15452880.

Related