Bonjour à tous,
Je suis débutant et pour créer un exécutable WINDOWS d'un code GTK
je fait comme ceci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #include <stdio.h> #include <stdlib.h> #include <gtk/gtk.h> int main(int argc, char *argv[]) { printf("La premiere fenêtre à RICO\n"); /* Init GTK */ gtk_init(&argc, &argv); /* Create main window */ GtkWidget *main_window=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(main_window),"La premiere fenetre a RICO"); /* Connect exit signal */ g_signal_connect(main_window,"delete-event",gtk_main_quit,NULL); /* Display window */ gtk_widget_show_all(main_window); /* Run main loop */ gtk_main(); /* The following will be executed after the main loop ends */ printf("Main loop exited\n"); return 0; }
Pour obtenir les paramétres à passer dans la ligne de commande, je fait comme ceci
Code : Sélectionner tout - Visualiser dans une fenêtre à part C:\MinGW\bin\gcc -mwindows C:\Fenetre2_GTK_WIN.c -o C:\Fenetre2_GTK_WIN.exe -mms-bitfields -IC:/GTK+/include/gtk-2.0 -IC:/GTK+/lib/gtk-2.0/include -IC:/GTK+/include/atk-1.0 -IC:/GTK+/include/cairo -IC:/GTK+/include/gdk-pixbuf-2.0 -IC:/GTK+/include/pango-1.0 -IC:/GTK+/include/glib-2.0 -IC:/GTK+/lib/glib-2.0/include -IC:/GTK+/include -IC:/GTK+/include/freetype2 -IC:/GTK+/include/libpng14 -LC:/GTK+/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl
Et mon executable Windows est bien créé
Code : Sélectionner tout - Visualiser dans une fenêtre à part C:\MinGW\bin\pkg-config --cflags --libs gtk+-2.0
Maintenant je voudrais compiler le même code source pour RASPBERRY
Pour ceci j'utilise un crosscompilateur "gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32"
J'ai déposé un "pkg-config.exe" dans le répertoire binaire de "gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32" et l'ai lancé pour faire la même méthode qu'au dessus, j'obtiens donc
Mais lorsque je lance ce code j'obtiens des pages d'erreurs
Code : Sélectionner tout - Visualiser dans une fenêtre à part C:\arm-linux-gnueabihf-gcc.exe "C:\Fenetre1_GTK.c" -o "C:\Fenetre_GTK_NUX.nux" -IC:/gtk+-3.5.4-1-bundle/include/gtk-3.0 -IC:/gtk+-3.5.4-1-bundle/include/atk-1.0 -IC:/gtk+-3.5.4-1-bundle/include/cairo -IC:/gtk+-3.5.4-1-bundle/include/gdk-pixbuf-2.0 -IC:/gtk+-3.5.4-1-bundle/include/pango-1.0 -IC:/gtk+-3.5.4-1-bundle/include/glib-2.0 -IC:/gtk+-3.5.4-1-bundle/lib/glib-2.0/include -IC:/gtk+-3.5.4-1-bundle/include -IC:/gtk+-3.5.4-1-bundle/include/pixman-1 -IC:/gtk+-3.5.4-1-bundle/include/freetype2 -IC:/gtk+-3.5.4-1-bundle/include/libpng15 -Wl,-luuid -LC:/gtk+-3.5.4-1-bundle/lib -lgtk-3 -lgdk-3 -limm32 -lshell32 -lole32 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpangoft2-1.0 -lpangowin32-1.0 -lgdi32 -lfreetype -lfontconfig -lpango-1.0 -lm -lcairo -lgobject-2.0 -lglib-2.0 -lintl
Je suppose donc que ce n'est pas du tout comme ceci qu'il faut s'y prendreIn file included from C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gal
loca.h:34,
from C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib.h:3
2,
from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gdk/gdkco
nfig.h:13,
from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gdk/gdk.h
:30,
from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gtk/gtk.h
:30,
from C:\Fenetre1_GTK.c:3:
C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gtypes.h:476:33: warning:
return type defaults to 'int' [-Wimplicit-int]
# define GLIB_VAR extern __declspec(dllimport)
^~~~~~~~~~
C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gmem.h:276:1: note: in ex
pansion of macro 'GLIB_VAR'
GLIB_VAR gboolean g_mem_gc_friendly;
^~~~~~~~
In file included from C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gli
st.h:34,
from C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gha
sh.h:35,
from C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib.h:5
2,
from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gdk/gdkco
nfig.h:13,
from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gdk/gdk.h
:30,
from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gtk/gtk.h
:30,
from C:\Fenetre1_GTK.c:3:
C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gmem.h: In function '__de
clspec':
C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gmem.h:280:10: error: exp
ected '=', ',', ';', 'asm' or '__attribute__' before 'GMemVTable'
GLIB_VAR GMemVTable *glib_mem_profiler_table;
^~~~~~~~~~
.........................
........................
etc ...thousands pages
Mais j'ai cherché pendant plusieurs jours et pas trouvé d'exemples complets pour faire ce genre de manipulations
Si quelqu'un a déjà fait ce genre de manipulation, je ne serais pas contre un petit peu d'aide pour comprendre le principe le plus simple de la crosscompilation Windows/Raspbian
Je vous remercie par avance et vous souhaite dors et déjà une bonne journée
Partager