View Full Version : [SOLVED] Cross-Compile GTK

September 13th, 2012, 01:55 AM
I have written a totally amazing GTK program that runs beautifully on Ubuntu 12.04 LTS. All I had to do was install "build-essentials" package and "gcc". Then I could place the code file named "code.c" in my home folder and run:

gcc code.c `pkg-config --cflags --libs gtk+-2.0`

... and the program would produce a binary named "a.out" which runs on Ubuntu just fine. (provided the card pictures are placed in "/Cards")

My question is: How do you get a GTK program to run on Windows?
I would like to show my programming teacher but he only has Windows machines at school.

I have a dual boot Windows-Ubuntu machine and Microsoft Visual Studio 2010 Ultimate. I have attempted to cross compile and even compile on windows, but I must tell you that I have no idea what im doing. Personally, I would be happier if every person ran Ubuntu.

This is my program:

took code down

Any help is appreciated.

September 13th, 2012, 02:32 AM
You'll need a Win32 or WinMain function as entry point, windows.h. Read through this page and halfway down it has a section on adapting Linux source code to windows.


Might want to try MinGW instead of visual studio.


More stuff I found: http://zetcode.com/gui/winapi/window/

September 13th, 2012, 04:01 AM
I would like to thank you so very much because my program is now working! I felt like I had searched forever for a solution which makes me feel dumb because you linked me to one in five minutes.

September 13th, 2012, 04:02 AM
Please mark [Solved] in thread tools menu :) Glad it worked out!