My term project in GTK was going on pretty well on my Debian until I had to show a demo to my teacher. And currently all the PCs in our labs only run windows. So I was pretty sure that I had no other way but to show the demo in windows. As everyone knows, GTK is multi-platform and with a bit of effort anyone can port GTK programs written in Linux to Windows in no time.
Here is how I compiled my GTK codes in VS 6.0:
Downloaded GTK runtime library and and GTK development installer files from this site
http://gladewin32.sourceforge.net/
There are two separate files, you need 2 download both of them: gtk-2.10.7-win32-1.exe and gtk-dev-2.10.7-win32-1.exe
Installed them both in C:\GTK
Now in VS 6.0 "File" > "New" > "Projects" > "Win32 Console Application" > "An Empty Project"
From Projects menu "Add to Project" > "New" > "Files" > "C++ Source File
Added a demo Gtk Code inside the file I named as gtk1.c:
// blogger seems to have some problem when i put angled brackets around gtk/gtk.h :((
#include gtk/gtk.h
void closeApp(GtkWidget *widget, gpointer data)
{
gtk_main_quit();
}
int main( int argc, char *argv[] )
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect(GTK_OBJECT(window),"destroy",GTK_SIGNAL_FUNC(closeApp),NULL);
gtk_widget_show (window);
gtk_main ();
return 0;
}
Now again in Project Menu > Settings
Here in "C++" Tab In the "Category" > "Preprocessor" under "Additional Include Directories" I put this
C:\GTK\include\gtk-2.0,C:\GTK\include\cairo,C:\GTK\include\glib-2.0,
C:\GTK\lib\glib-2.0\include,C:\GTK\include\pango-1.0,C:\GTK\lib\gtk-2.0\include,
C:\GTK\include\atk-1.0,C:\GTK\include\libxml2
Now in the "Link" tab under "Object/Library modules" put
glib-2.0.lib gobject-2.0.lib gthread-2.0.lib gdk-win32-2.0.lib gdk_pixbuf-2.0.lib gtk-win32-2.0.lib atk-1.0.lib pango-1.0.lib
Now just just after pressing OK, Ctrl + F7 to compile, F7 to build gtk.exe and then Ctrl + F5 to run the programme.
It rewarded me with this GTK window.
Subscribe to:
Post Comments (Atom)
Back to Blogging
After a failed attempt last year to get back to blogging, I'm trying it again this year. I really wanted to get back, but got busy will...
-
For my Univ project, I need 2 use graphics.h. Everyone knows graphics.h is not in C's standard library. Only Turbo C supports it and for...
-
Make sure you have grub installed in the same partition as the Ubuntu, not in MBR. Now boot into any linux Live CD and do this: $sudo dd if=...
-
Normally, when we are coding java in Eclipse , we do not see any javadoc help when we hover over a keyword. This is because by default, ecli...
No comments:
Post a Comment