Męczę się z tym kilka dni i nic.
Robię wszystko według instrukcji tzn.
1. Pobieram i wypakowuję gtk.
1. Nowy projekt, podaję wszystko, co trzeba. Nie zmieniam innych ustawień.
Mam teraz 3 pliki: project, layout i main.c
*2. Jestem w pliku project. Tworzę plik źródłowy. Do "Filename with full path" wklejam ścieżkę do folderu, w którym są pliki z pkt 1. Tu też wszystko zostawiam domyślne.
3. Wklejam kod programu z drugiej lekcji kursu gtk do utworzonego pliku źródłowego.
4. Wklejam potrzebne opcje kompilatora i linkera i naciskam ok.
5. Wciskam F9 i pełno błędów. Fragment:
-------------- Build: Debug in tytul ---------------
Compiling: main.c
In file included from C:\opt\gtk\include\gtk-2.0/gdk/gdkcairo.h:28,
from C:\opt\gtk\include\gtk-2.0/gdk/gdk.h:33,
from C:\opt\gtk\include\gtk-2.0/gtk/gtk.h:32,
from C:\Documents and Settings\aaa\Pulpit\program gtk\tytul\main.c:2:
C:\opt\gtk\include\gtk-2.0/gdk/gdkpixbuf.h:37:35: error: gdk-pixbuf/gdk-pixbuf.h: No such file or directory
In file included from C:\opt\gtk\include\gtk-2.0/gdk/gdkcairo.h:28,
from C:\opt\gtk\include\gtk-2.0/gdk/gdk.h:33,
from C:\opt\gtk\include\gtk-2.0/gtk/gtk.h:32,
from C:\Documents and Settings\aaa\Pulpit\program gtk\tytul\main.c:2:
C:\opt\gtk\include\gtk-2.0/gdk/gdkpixbuf.h:43: error: expected ')' before '*' token
C:\opt\gtk\include\gtk-2.0/gdk/gdkpixbuf.h:53: error: expected ')' before '*' token
C:\opt\gtk\include\gtk-2.0/gdk/gdkpixbuf.h:65: error: expected ')' before '*' token
C:\opt\gtk\include\gtk-2.0/gdk/gdkpixbuf.h:79: error: expected ')' before '*' token
C:\opt\gtk\include\gtk-2.0/gdk/gdkpixbuf.h:85: error: expected ')' before '*' token
C:\opt\gtk\include\gtk-2.0/gdk/gdkpixbuf.h:93: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
Ale poza tym teraz w Code::Blocks otwiera mi się nowa karta "gdkpixbuf.h". Fragment zawartości:
am and others 1997 - 2000.See the AUTHORS
* file for a list of people on the GTK + Team.See the ChangeLog
* files for a list of changes.These files are distributed with
* GTK + at ftp:
*/
#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_PIXBUF_H__
#define __GDK_PIXBUF_H__
#include <cairo.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkrgb.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
void gdk_pixbuf_render_threshold_alpha( GdkPixbuf * pixbuf,
GdkBitmap * bitmap,
int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int height,
int alpha_threshold );
#ifndef GDK_DISABLE_DEPRECATED
void gdk_pixbuf_render_to_drawable( GdkPixbuf * pixbuf,
GdkDrawable * drawable,
GdkGC * gc,
int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int he
* main.c zawiera taki kod:
#include <stdlib.h>
#include <gtk/gtk.h>
static void helloWorld( GtkWidget * wid, GtkWidget * win )
{
GtkWidget * dialog = NULL;
dialog = gtk_message_dialog_new( GTK_WINDOW( win ), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "Hello World!" );
gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER );
gtk_dialog_run( GTK_DIALOG( dialog ) );
gtk_widget_destroy( dialog );
}
int main( int argc, char * argv[] )
{
GtkWidget * button = NULL;
GtkWidget * win = NULL;
GtkWidget * vbox = NULL;
g_log_set_handler( "Gtk", G_LOG_LEVEL_WARNING,( GLogFunc ) gtk_false, NULL );
gtk_init( & argc, & argv );
g_log_set_handler( "Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL );
win = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_container_set_border_width( GTK_CONTAINER( win ), 8 );
gtk_window_set_title( GTK_WINDOW( win ), "Hello World" );
gtk_window_set_position( GTK_WINDOW( win ), GTK_WIN_POS_CENTER );
gtk_widget_realize( win );
g_signal_connect( win, "destroy", gtk_main_quit, NULL );
vbox = gtk_vbox_new( TRUE, 6 );
gtk_container_add( GTK_CONTAINER( win ), vbox );
button = gtk_button_new_from_stock( GTK_STOCK_DIALOG_INFO );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( helloWorld ),( gpointer ) win );
gtk_box_pack_start( GTK_BOX( vbox ), button, TRUE, TRUE, 0 );
button = gtk_button_new_from_stock( GTK_STOCK_CLOSE );
g_signal_connect( button, "clicked", gtk_main_quit, NULL );
gtk_box_pack_start( GTK_BOX( vbox ), button, TRUE, TRUE, 0 );
gtk_widget_show_all( win );
gtk_main();
return 0;
}
"Hello world" ?! Nie wiem skąd to się bierze.
Edit: Może to są pozostałości po poprzednich próbach, ale przecież robiłem wszystko od nowa.
---------
Proszę o pomoc.