3

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
mdeous
  • 17,513
  • 7
  • 56
  • 60
user541686
  • 205,094
  • 128
  • 528
  • 886
  • 1
    possible duplicate of [Can Cython compile to an EXE?](http://stackoverflow.com/questions/2581784/can-cython-compile-to-an-exe) – Ferdinand Beyer Aug 09 '11 at 08:18

1 Answers1

7

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 no main(). This can be changed by supplying the --embed option, 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++.

Community
  • 1
  • 1
Ferdinand Beyer
  • 64,979
  • 15
  • 154
  • 145