# please include python26_d.lib in the installer

Carl Banks pavlovevidence at gmail.com
Fri Mar 27 17:01:49 CET 2009

```On Mar 27, 1:48 am, Compie <joh... at gmail.com> wrote:
> I get this linker error
> LINK : fatal error LNK1104: cannot open file 'python26_d.lib'
> when I build the debug version of my Visual Studio project.
>
> This is caused by the following lines in the file c:\Python26\include
> \pyconfig.h
> #                       ifdef _DEBUG
> #                               pragma comment(lib,"python26_d.lib")
> #                       else
> #                               pragma comment(lib,"python26.lib")
> #                       endif /* _DEBUG */
>
> The file python26_d.lib is not installed by the Python installer on
> Windows.
>
> 1. Provide python26_d.lib in the installer.
> or
> 2. Remove this automatic "pragma comment lib" from pyconfig.h, since I
> can't disable it from the outside (as far as I know).
>
> Please note: I want to build my own code in Debug mode for debugging.
> I don't want to build or use the debug version of Python. I also can't
> #undef _DEBUG, since the file that includes pyconfig.h (via Python.h)
> is generated by SWIG. Also I prefer not to change pyconfig.h myself,
> since my code needs to compile on a lot of different machines.

python26_d.dll *is* the debugging version of Python.

As a workaround to the situation, try to copy the file python26.dll to
python26_d.dll.  (I'm not sure this will work; you say you are
building a SWIG library in debug mode, and it's possible that SWIG
will try to use features of the Python debugging version.  If that's
the case, you'll have no choice but to use the debugging version of
Python.)

OTOH, it's possible that SWIG and Python just happen to use the same
macro to indicate debugging mode.  So I think you raise a valid point
that this can be problematic.  Perhaps something like _Py_DEBUG should