GTK+ Make Cygwin Error
ive just done so much research and tried so much but nothing works. I am trying to compile a simple hello world program in GTK in Cygwin using make. It gives me error: "lab0.c:1:21: error: gtk/gtk.h: No such file or directory...." I installed cygwin with all packages. I also imported the all in one gtk files into the cygwin folders but it gives me same error. Here are my programs:
Lab0.c
#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *label;
gtk_init (&argc, &argv);
/* create the main, top level, window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/* give it the title */
gtk_window_set_title (GTK_WINDOW (window), "Hello World");
/* Connect the destroy signal of the window to gtk_main_quit
* When the window is about to be destroyed we get a notification and
* stop the main GTK+ loop
*/
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
/* Create the "Hello, World" label */
label = gtk_label_new ("Hello, World");
/* and insert it into the main window */
gtk_container_add (GTK_CONTAINER (window), label);
开发者_如何学C/* make sure that everything, window and label, are visible */
gtk_widget_show_all (window);
/* start the main loop, and let it rest there until the application is closed */
gtk_main ();
return 0;
}
makefile
# Makefile for Hello World Program (lab0).
all: lab0
lab0: lab0.o
g++ -Wall lab0.o -o lab0
lab0.o: lab0.c
g++ -Wall -c lab0.c -o lab0.o
I really need to get gtk working. Please help me.
You need to install the libgtk2.0-devel package to get the header files you need for development; you probably only installed the runtime and/or source code packages, which are not sufficient.
The proper package as Adam stated is the libgtk2.0-devel package in the cygwin setup. You can rerun the setup program and select the package from the list. Search for gtk and you'll find it. I'm actually installing it right now :)
When you get to the Select Packages screen. Go to X11 and select the aforementioned package.
You can also check if you have versions 1.2 and 2.0 installed at the same time, maybe it could cause problems.
精彩评论