Nous sommes le Ven 25/05/2012, 0:19




Poster un nouveau sujet RĂ©pondre au sujet  [ 9 messages ] 
 [programmation]Interface graphique en C 
Auteur Message
Lézard Bavard
Avatar de l’utilisateur

Inscription: Ven 24/08/2007, 16:00
Messages: 786
Localisation: Saint-Etienne > France
Message [programmation]Interface graphique en C
J'ai un petit soucis,
Il faut que je fasse une interface graphique qui récupÚre et affiche les valeurs retourné par des morceaux de code déjà fait en C (des codes qui font des pings un peu particuliers avec du wifi). Pour me faciliter les choses je pensais également faire l'interface en C ... mais j'ai jamais eu l'occasion d'en faire autrement qu'en Java. :?
Le problÚme c'est que le C "de base" ne permet pas de faire tout ça ... donc il faut que je rajoute des librairies.
J'ai trouvé "SDL" mais ça à l'air plutÎt fait pour faire des petites applications 2D sans boutons, ni menus.
Sinon il y "API Win32" ... mais elle exclusivement sous Windows ... et les morceaux de code que j'ai déjà sont ... exclusivement sous linux. :(
La derniÚre que j'ai trouvé c'est "GTK" . Elle est exclusivement sous Linux et elle permet de faire pas mal de chose donc je pense que c'est celle qui conviendrait le mieux.
... par contre j'arrive pas Ă  m'en servir :evil:
J'ai testĂ© sous "KDevelop", "Eclipse C/C++" et "Code::Blocks" ...et Ă  chaque fois j'ai pas trouvĂ© le moyen de compiler correctement des programme tout bĂȘtes.
Est-ce que quelqu'un à déjà utilisé GTK ? ou fait des interfaces graphiques en C ? (et dans ce cas.. comment ?)
Sinon vous me conseillez quoi comme logiciel pour le développement, parce que j'ai l'impression qu'Eclipse est pas franchement prévu pour faire du C

J'y ai passé la journée donc là j'enrage un peu mais je suis prés a tester n'importe quoi :D :wink:

Voila, je sais pas si il y a encore beaucoup de programmeurs qui passent sur le forum :roll: mais j'ai vu qu'il y avait eu quelques autres discussion donc je tente parce que là je désespÚre franchement :ordi:


Sam 08/12/2007, 16:08
Profil Site Internet
Lézardinomane
Avatar de l’utilisateur

Inscription: Dim 03/10/2004, 17:08
Messages: 4551
Localisation: Bretagne
Message 
Tu as quelles erreurs Ă  la compilation ?

_________________
Blog http://www.divarvel.fr
Eklaweb http://www.eklaweb.com
ImageImageImage


Sam 08/12/2007, 17:06
Profil Site Internet
Lézard Bavard
Avatar de l’utilisateur

Inscription: Ven 24/08/2007, 16:00
Messages: 786
Localisation: Saint-Etienne > France
Message 
divarvel a écrit:
Tu as quelles erreurs Ă  la compilation ?

en testant la compilation de ce fichier:
http://monsitecpp.free.fr/tutoriaux/gtk/telechargement/main.c

Avec CodeBlocks ça me donne:
Citation:
Can't create object output directory /obj/Debug/programmation/projetgraphic/


A quoi ça sert /obj/debug ? parce que ça fait plusieurs fois que je tombe sur ces dossier .... j'ai l'impression que je ne peut rien faire dedans (surtout qu'ils sont vide).

Avec Eclipse:
Citation:
Launch failed no binaries

Bon je suis vraiment mauvais en programmation. Donc je pense que là ça doit venir du fait que Eclipse ne sais pas compiler un fichier .c tout seul (il lui faut des .h ou des trucs comme ça nan ? )

Avec KDevelop:
Citation:
cd '/home/NouNours/programmation/projetgraphique' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -f Makefile.cvs && mkdir '/home/NouNours/programmation/projetgraphique/debug' && cd '/home/NouNours/programmation/projetgraphique/debug' && CFLAGS="-O0 -g3 " "/home/NouNours/programmation/projetgraphique/configure" --enable-debug=full && cd '/home/NouNours/programmation/projetgraphique/debug/src' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k projetgraphique.lo
aclocal
autoheader
automake
autoconf
Processus d'installation -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... no
checking for g95... no
checking for xlf95... no
checking for f95... no
checking for fort... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... no
Édition des liens file.o... (gcc)
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... no
Édition des liens file.o... (g++)
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: executing depfiles commands
Compilation projetgraphique.c (gcc)
mkdir .libs
Compilation projetgraphique.c (gcc)
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:26:21: erreur: gtk/gtk.h : Aucun fichier ou répertoire de ce type
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c: In function ‘main’:
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:30: erreur: ‘GtkWidget’ undeclared (first use in this function)
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:30: erreur: (Each undeclared identifier is reported only once
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:30: erreur: for each function it appears in.)
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:30: erreur: ‘p_Window’ undeclared (first use in this function)
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:31: erreur: ‘p_Label’ undeclared (first use in this function)
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:32: erreur: ‘gchar’ undeclared (first use in this function)
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:32: erreur: ‘sUtf8’ undeclared (first use in this function)
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:36: erreur: ‘GTK_WINDOW_TOPLEVEL’ undeclared (first use in this function)
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:39: erreur: ‘GTK_WIN_POS_CENTER’ undeclared (first use in this function)
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:40: erreur: ‘gtk_main_quit’ undeclared (first use in this function)
gmake: *** [projetgraphique.lo] Erreur 1
*** Sortie avec l'état : 2 ***

Voilà :? ... je pense que le plus intéressant est sur la fin ... mais comme je ne comprend pas le début je te l'ai laissé

Apparemment il ne me trouve pas la librairie:
Citation:
/home/NouNours/programmation/projetgraphique/src/projetgraphique.c:26:21: erreur: gtk/gtk.h : Aucun fichier ou répertoire de ce type
pourtant je l'ai réinstallée plusieurs fois (elle va se mettre dans usr/lib et usr/include je sais pas si c'est normal par contre ... )


Sam 08/12/2007, 17:37
Profil Site Internet
Lézardinomane
Avatar de l’utilisateur

Inscription: Dim 03/10/2004, 17:08
Messages: 4551
Localisation: Bretagne
Message 
Il faut peut ĂȘtre indiquer au soft oĂč elle se trouve. (perso j'ai jamais beaucoup codĂ© en C, donc je suis pas expert, mais ça ressemble pas mal Ă  un mauvais chemin)

_________________
Blog http://www.divarvel.fr
Eklaweb http://www.eklaweb.com
ImageImageImage


Sam 08/12/2007, 19:15
Profil Site Internet
Lézard Accro
Avatar de l’utilisateur

Inscription: Mer 01/02/2006, 8:08
Messages: 1507
Localisation: Paris, France
Message 
Et tes petits bouts de code, ça serait pas possible de les recoder en Java?
Avec Netbeans c'est trĂšs simple de crĂ©er une interface toute prĂȘte.

_________________
Image
Bouh!


Sam 08/12/2007, 21:32
Profil Site Internet
Lézardinomane
Avatar de l’utilisateur

Inscription: Jeu 24/07/2003, 2:08
Messages: 3585
Localisation: Charlo/Moncton (dépendant), N.-B.
Message 
je peux pas aider ben ben, j'ai juste codé quelques cochonneries en C++ avec VB 6... a part vérifier les path name et les appels de fonctions et autre... :?

_________________
time is an excellent teacher, unfortunately, it kills all of his students


Sam 08/12/2007, 22:12
Profil
Lézard Bavard
Avatar de l’utilisateur

Inscription: Ven 24/08/2007, 16:00
Messages: 786
Localisation: Saint-Etienne > France
Message 
Bon finalement c'est a peu pres réglé.
J'ai réinstallé complÚtement Mandriva parce que j'avais fini par mettre un beau bazard (par exemple désinstaller GTK alors qu'il est utilisé par compiz ... :S )


J'ai rĂ©installĂ© Eclipse mais j'avais toujours le mĂȘme problĂšme donc je suis repassĂ© par gcc avec l'option qui va bien
Citation:
gcc main.c -o executable `pkg-config --cflags --libs gtk+-2.0`

et là ça fonctionne :>
( les lignes de commandes ... finalement c'est bien :D )

toutounek a écrit:
Et tes petits bouts de code, ça serait pas possible de les recoder en Java?
Avec Netbeans c'est trĂšs simple de crĂ©er une interface toute prĂȘte.

C'est ce que je pensais faire au départ: recoder les morceaux de code en Java :wink: Mais il y aura d'autres morceaux de code à ajouter dans quelques semaines donc j'ai préféré préparer une interface qui sera prete à les accueillir.
( et puis je suis pas franchement fort en Java non plus ... j'aurai sûrement galérer à trouver des fonctions équivalentes :wink: )


Dim 09/12/2007, 8:45
Profil Site Internet
Lézardinomane
Avatar de l’utilisateur

Inscription: Mar 29/06/2004, 15:48
Messages: 5597
Localisation: Belgique
Message 
j'arrive un peu tard lol mais je ne connai(sais) que gcc xD
pour les interfaces :? j'en ai jamais eu besoin... prq pas mettre les données que tu récoltes dans une base sql et ensuite ... petit code php ?

_________________
Image


Jeu 13/12/2007, 16:08
Profil
œ LĂ©zard
Avatar de l’utilisateur

Inscription: Mer 17/03/2004, 14:37
Messages: 389
Localisation: Canada
Message 
Pour faire du C++ dans Eclipse, voici un lien vraiment utile pour savoir comment ça fonctionne et quoi installer:

(en anglais) http://max.berger.name/howto/cdt/ar01s03.jsp

_________________
Everything that is really great and inspiring is created by the individual who can labor in freedom
-Albert Einstein


Mer 19/12/2007, 16:10
Profil Site Internet
Afficher les messages postĂ©s depuis:  Trier par  
Poster un nouveau sujet RĂ©pondre au sujet  [ 9 messages ] 


Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 0 invités


Vous ne pouvez pas poster de nouveaux sujets
Vous ne pouvez pas répondre aux sujets
Vous ne pouvez pas éditer vos messages
Vous ne pouvez pas supprimer vos messages

Rechercher:
Aller Ă :  
cron