Hello guys I'm using c++ and gtk+ 2 I want to make a simple paint program like MS program but by these two tools only okay I just started and I want your hands to reach the end :) look to my code here
Code:
#include <gtk/gtk.h>
int main( int argc,char *argv[] )
{
GtkWidget* window;
GtkWidget* drawingArea;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "delete_event",G_CALLBACK (gtk_main_quit), G_OBJECT(window));
g_signal_connect (G_OBJECT (window), "destroy",G_CALLBACK (gtk_main_quit), G_OBJECT(window));
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
drawingArea = gtk_drawing_area_new();
/*The problem is in the next line*/
gtk_drawing_area_size(G_OBJECT(drawingArea),200,200);
gtk_container_add (GTK_CONTAINER (window), drawingArea);
gtk_widget_show (drawingArea);
gtk_widget_show (window);
gtk_main ();
return 0;
}
my problem is in the commented line
Code:
gtk_drawing_area_size(G_OBJECT(drawingArea),200,200);
the error when compiling
Code:
ibrahim@ibrahim-PC:~/Desktop$ gcc main.cpp -o base `pkg-config --cflags --libs gtk+-2.0`
main.cpp: In function ‘int main(int, char**)’:
main.cpp:14:52: error: cannot convert ‘GObject* {aka _GObject*}’ to ‘GtkDrawingArea* {aka _GtkDrawingArea*}’ for argument ‘1’ to ‘void gtk_drawing_area_size(GtkDrawingArea*, gint, gint)’
So Please help me