Fórum Ubuntu CZ/SK

Ubuntu pro osobní počítače => Software => Příkazový řádek a programování pro GNU/Linux => Téma založeno: Maculko 18 Února 2010, 18:41:14

Název: graficka notifikacia
Přispěvatel: Maculko 18 Února 2010, 18:41:14
cavte vsetci
vcera som sa dozvedel o notify-send..... hned ma to zaujalo a zakonponoval som to do svojo mini programiku v ccku..... ale to len forknutim procesov a execom na jeden z nich.... je mozne vyuzit nejaku kniznicu a robit tuto notifikaciu elegantnejsie????
Název: Re: graficka notifikacia
Přispěvatel: q66 18 Února 2010, 20:26:03
projdi si dokumentaci k libnotify.
Název: Re: graficka notifikacia
Přispěvatel: Maculko 21 Února 2010, 09:41:52
cavte tak som sa o nieco take pokusil

v subore som dal include <libnotify/notify.h>

ale ked som sa to pokusil skompilovat dostal som toto
Kód: [Vybrat]
gcc `pkg-config –cflags –libs gtk+-2.0` libotifyPokus.c -o notify -l notify
In file included from libotifyPokus.c:1:
/usr/include/libnotify/notify.h:24:18: error: glib.h: No such file or directory
In file included from /usr/include/libnotify/notify.h:27,
                 from libotifyPokus.c:1:
/usr/include/libnotify/notification.h:26:25: error: glib-object.h: No such file or directory
/usr/include/libnotify/notification.h:27:21: error: gtk/gtk.h: No such file or directory
In file included from /usr/include/libnotify/notify.h:27,
                 from libotifyPokus.c:1:
/usr/include/libnotify/notification.h:50: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
/usr/include/libnotify/notification.h:56: error: expected specifier-qualifier-list before ‘GObject’
/usr/include/libnotify/notification.h:62: error: expected specifier-qualifier-list before ‘GObjectClass’
/usr/include/libnotify/notification.h:79: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:85: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘notify_notification_get_type’
/usr/include/libnotify/notification.h:87: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/libnotify/notification.h:91:22: error: missing binary operator before token "("
/usr/include/libnotify/notification.h:97: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘notify_notification_update’
/usr/include/libnotify/notification.h:102: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:105:22: error: missing binary operator before token "("
/usr/include/libnotify/notification.h:110: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:115: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘notify_notification_show’
/usr/include/libnotify/notification.h:118: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:121: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:124: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:127: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:130: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:132: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:135: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:138: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:142: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:145: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:149: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:151: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:156: error: expected ‘)’ before ‘*’ token
/usr/include/libnotify/notification.h:157: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘notify_notification_close’
/usr/include/libnotify/notification.h:160: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘notify_notification_get_closed_reason’
In file included from /usr/include/libnotify/notify.h:28,
                 from libotifyPokus.c:1:
/usr/include/libnotify/notify-enum-types.h:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘G_BEGIN_DECLS’
In file included from libotifyPokus.c:1:
/usr/include/libnotify/notify.h:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘G_BEGIN_DECLS’
/usr/include/libnotify/notify.h:54: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘notify_is_initted’
/usr/include/libnotify/notify.h:61: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/libnotify/notify.h:68: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/libnotify/notify.h:82: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘notify_get_server_info’
libotifyPokus.c:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’

neviete poradit co robim zle..... nemoze byt predsa tolko chyb v tej kniznici
Název: Re: graficka notifikacia
Přispěvatel: Martin - ViPEr*CZ* 21 Února 2010, 09:44:26
Hned chyba ve 3. řádku:

Kód: [Vybrat]
/usr/include/libnotify/notify.h:24:18: error: glib.h: No such file or directory
Název: Re: graficka notifikacia
Přispěvatel: Maculko 21 Února 2010, 10:49:39
Hned chyba ve 3. řádku:

Kód: [Vybrat]
/usr/include/libnotify/notify.h:24:18: error: glib.h: No such file or directory

no jasne ja tie chyby chapem ale vsetky su v tej pribalenej kniznici.... a neviem co mi este chyba.... glib.h som si nasiel hodil ho na spravne miesto chyba odisla (ale prislo dalsich 20) ale tymto sposobom je to dost narocne hladanie riesenia nieco mi zjavne chyba neviete co by som v synapticu mohol este doinstalovat aby to islo??? .... lebo ked som si nasiel glib-object.h vidim ze je to iba subor ktory includuje dalsich 10 suborov a takto vsetky hladat je nemozne...,,pls help :)
Název: Re: graficka notifikacia
Přispěvatel: Martin - ViPEr*CZ* 21 Února 2010, 13:34:46
Ono glib se kompiluje tak, že je potřeba přilinkovat jeho dynamickou tuším knihovnu...

http://library.gnome.org/devel/glib/stable/glib-compiling.html

Chce to trochu se naučit používat google, pokud se chcete todle naučit!
Název: Re: graficka notifikacia
Přispěvatel: q66 21 Února 2010, 14:10:46
pokud používáš configure.ac, ověřuj glib v configure.ac jako třeba

Kód: [Vybrat]
PKG_CHECK_MODULES(MYAPP, [
  glib-2.0
  libnotify
])

a pak v Makefile.am:
Kód: [Vybrat]
MAINTAINERCLEANFILES = Makefile.in

INCLUDES = \
-Wall -g \
-I$(top_srcdir) \
-I$(top_srcdir)/src/bin \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
@MYAPP_CFLAGS@

bin_PROGRAMS = myapp

myapp_INCLUDES = myapp.h

myapp_SOURCES = main.c $(myapp_INCLUDES)

myapp_LDADD = @MYAPP_LIBS@


pokud autotools nepoužíváš, a používáš jen gcc, použij

Kód: [Vybrat]
gcc main.c -o myapp $(pkg-config --libs --cflags glib-2.0 libnotify)