Once I’ve used Cython to generate a C file, how do I use the Visual C++ 2010 compiler to make an EXE?
I’ve tried
cython.py Temp.py
cl.exe /MD /I "%ProgramFiles%\Python 2.6\include" Temp.c /link
/LibPath:"%ProgramFiles%\Python 2.6\libs"
but it says
LINK : fatal error LNK1561: entry point must be defined
and if I change the /MD option to /MT then I getTemp.c
LIBCMT.lib(crt0.obj) : error LNK2019:
unresolved external symbol main referenced in function __tmainCRTStartup
By default, Cython does not generate the code for an executable, but for a Python module. For example, it generates an
init<modulename>()function, but nomain(). This can be changed by supplying the--embedoption, as explained in Embedding Cython.See also: Can Cython compile to an EXE? — one answer even gives an example on how to do it using VC++.