2

I have compiled my program, he works. But i use tkinter and i want compile this program.

My commands :

cython.exe --embed file.py -o file.c

gcc.exe file.c -o file -I C:/Python27/include -L C:/Python/libs -lpython27

I use cygwin and mingw32, and i am on windows.

My program works but i have windows console with, and i don't want that console.

My research find that pythonw.exe don't launch console, and i think py2exe use that, but i want one file, i use cython for that.

Can i launch pythonw.exe with cython and not python.exe ? Or better, can i disable console ? How ?

Thanks in advance.

Basj
  • 41,386
  • 99
  • 383
  • 673
Gadgetroch
  • 21
  • 2

1 Answers1

2

Add -Wl,--subsystem,windows to your gcc commandline on your link step. In your case:

gcc -o file file.c -I c:/Python27/include -L c:/Python27/libs -lpython27 -Wl,--subsystem,windows

This will pass along --subsystem windows to the linker, which will produce an executable which runs without a console window.

mkimball
  • 764
  • 4
  • 9
  • Thans for you response, he works ! But i have two problems now... On an other computer, he want python27.dll, but i'm created libpython27.a etc... How ? And, when i have installed python27.dll, he didn't work, nothing error message, nothing program... – Gadgetroch Aug 20 '13 at 21:59
  • If you are trying to deploy to another machine, that does get tricky to track down all the dependencies. I'd start by copying your version of c:\windows\system32\python27.dll (you might find it in c:\windows\syswow64\python27.dll) and put it in the same folder as your .exe. Also, copy everything from c:\python27\DLLs\ and put those files in the same folder. (NOT in a DLLs subfolder.) Do the same for c:\python27\lib\ (again, in the same folder, not in a subfolder.) – mkimball Aug 21 '13 at 00:39
  • Can i compile all this file in my exe for one standalone program ? With which command ? Can you give me the gcc command please ? – Gadgetroch Aug 21 '13 at 10:14
  • Thanks for the suggestion, but it raises a fatal error: `error LNK2019: unresolved external symbol WinMain referenced in function "int __cdecl __scrt_common_main_seh(void)" (?__scrt_common_main_seh@@YAHXZ)` – Jay May 27 '19 at 12:05
  • Never mind, I messed around with the generated file renaming methods until I got it to work, thank you so much you're a life saver!!! – Jay May 27 '19 at 12:28