Ur-fault
Ur-fault

Reputation: 35

How to compile cython-compiled c code on Windows using Visual Studio Compilers

I want to compile my python code with cython. Compilation of my code in cython is without problems, but I can't compile it to executable.

cl .\setup.c /I C:\Users\Host\AppData\Local\Programs\Python\Python37\include

And error I am getting is

/out:setup.exe
setup.obj
LINK : fatal error LNK1104: cannot open file 'python37.lib'

I am using 64 bit version of Windows 10 and python 3.7

Thanks a lot.

Upvotes: 0

Views: 719

Answers (1)

dxiv
dxiv

Reputation: 17678

LNK1104 means the linker could not find python37.lib in the default paths set in the LIB environment.

To correct that, the directory of python37.lib needs to be added to the library search path passed to the linker. Given the posted command line, this would most likely be:

cl .\setup.c /I "C:\Users\Host\AppData\Local\Programs\Python\Python37\include" /link /LIBPATH:"C:\Users\Host\AppData\Local\Programs\Python\Python37\libs"

Upvotes: 2

Related Questions