first greeting to everyone here. this is a nice forum that we can share and discuss.

I used to do a GUI program in c using GTK 2.0 under the cygwin platform, but the built file (.exe file) can only display the GUI at the Unix environment (cygwin X11 server), so any idea on how to let the .exe file be able to run (display GUI) on windows by itself, no need to turn on the x11 server.

thanks !

Recommended Answers

All 7 Replies

compile it on MS-Windows with a compiler that supports MS-Windows or use a cross compiler on *nix that generates MS-Windows file format executables. Just simply renaming the file is not sufficient.

Use a windows compiler to compile your code, and use a native windows version of the GTK library (assuming one exists).

compile it on MS-Windows with a compiler that supports MS-Windows or use a cross compiler on *nix that generates MS-Windows file format executables. Just simply renaming the file is not sufficient.

yup, this is what I am trying to do. but i do not know how to do cross compiling, can you tell me such a cross complier that i can use to compile GTK program? thanks !

Use a windows compiler to compile your code, and use a native windows version of the GTK library (assuming one exists).

can you tell me a windows compiler for compiling C program. I am new to software development. Thanks a lot!

MingW is a popular windows compiler (for C and C++) - a windows port of the linux GCC tools.

have a look here http://www.mingw.org/

I have no idea whether it supports any of the GTK libraries you're using, you will most likely need to google around for windows versions of those

Please see this thread http://www.daniweb.com/forums/thread86245.html I have used gtk with mingw quite a lot, but unfortunately not with cygwin. I know though, that there is a cygwin gtk port for windows gui as well, but unfortunately i have not much idea how to find it. The gtk package which you mentioned is likely gtk2-x11, i know there is also gtk+ package for cygwin, but this might be for gtk 1.2, not gtk 2... But what concerns mingw port, please ask if you have any problems installing it, likely better in the original thread. There used to be some packages for installing all gtk development files at once, but all which i ever knew, are unmaintained and broken by now. Many things necessary for gtk are really part of gnuwin32, which can be installed completely, but there would be a lot of things unnecessary then.

One way how you certainly can use gtk in cygwin with win32 gdk backend, is to install gtk source, and compile it with the appropriate options. This is not likely a very convenient option for many though. You can also use mingw gtk with cygwin gcc, when you use the -mno-cygwin flag, as it is said in the Tor Lillqwist site http://www.gimp.org/~tml/gimp/win32 This flag may though cause some problems in cygwin, but it's still likely somewhat better than using mingw, when you have cygwin.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.