[python-win32] Compiling python functions in a c file on windows
Mark Tolonen
metolone+gmane at gmail.com
Sat Aug 7 09:13:32 CEST 2010
"David Hutto" <smokefloat at gmail.com> wrote in message
news:AANLkTinKVsK60swwvFp-P30OTvCLiAeRqO7j_XgaWVn7 at mail.gmail.com...
> While trying to go through the tutorial in the official python
> documentation, I'm encountering a problem on Windows(ubuntu/linux
> compiles the same test file fine)
>
> I'm just using a 'dummy' function at this point, so no other errors are
> thrown:
>
> #include "c:\\Python31\\include\\Python.h"
>
> int main() {
>
> }
>
>
> When compiling the test file on Visual C++ 2008/9.0 Express it shows the
> error:
>
> LINK : fatal error LNK1104: cannot open file 'python31_d.lib'
>
> I know that this is the debug lib for my version of python on windows.
> I've built the current source tarball, but it seems that it is two
> versions down(the one available for install is r312:79149, and the
> tarball is r312:79147, which builds the pythoncore fine in debug, but
> not in release).
> So I have the debug(python31_d.lib), for the tarball version, but not the
> first.
>
> Compiling python/c on windows is not as easy, when compared to ubuntu,
> although I'm sure it's something minor I'm missing(last time was a
> toggle box that took me two days to figure out wasn't checked).
>
> So, before I go on a testing rant, do I need to build the debug
> pythoncore from the currently used version, not the tarball, or does
> it matter(I'm guessing so, because of the syntax error, and a million
> unknown character errors I get when trying to use the two down version
> on the tarball)?.
>
> This is just to see if their is an easier way(or something simpler
> than I thought) to do this. If not, then on to svn checkout.
>
> It seems as though ubuntu would want the python debug file too(however
> I have downloaded several packages related to python development that
> may have contained this necessary requirement).
Is the directory containing python31_d.lib in the linker's search path?
If you add the python include and lib paths to the following dialog
(VS2008-specific):
Tools, Options, Projects and Solutions, VC++ Directories
Show directories for: Include Files
Show directories for: Library Files
This makes them available to any project without hard-coding paths in source
code or project settings.
Alternatively, hard-code the paths in the project's properties:
Project, Properties, Configuration Properties, C/C++, General, Additional
Include Directories
Project, Properties, Configuration Properties, Linker, General,
Additional Library Directories
In both cases, make sure both Debug and Release builds have the paths set
correctly.
-Mark
More information about the python-win32
mailing list