News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Erreur compiling

Started by Metallica, October 10, 2007, 11:21:41 AM

Previous topic - Next topic

Metallica

Hi all
i'm a novic here. :D
i was using shell to compile my C files
so i wrote a dbus programm with c and i was compiling it like this:
gcc `pkg-config --libs --cflags dbus-1 dbus-glib-1 glib-2.0` dbus-ping-listen.c
and it works.
but when i use codeblocks i have this error

Compiling: /home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:1:18: erreur:
glib.h : Aucun fichier ou répertoire de ce type
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:2:23: erreur: dbus/dbus.h : Aucun fichier ou répertoire de ce type
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:3:28: erreur: dbus/dbus-glib.h : Aucun fichier ou répertoire de ce type
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:4: erreur: «DBusHandlerResult" does not name a type
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c: In function «int main(int, char**)":
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:8: erreur: «GMainLoop" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:8: erreur: «loop" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:9: erreur: «DBusConnection" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:9: erreur: «bus" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:10: erreur: «DBusError" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:10: erreur: expected `;' before «error"
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:11: erreur: «NULL" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:11: erreur: «FALSE" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:11: erreur: «g_main_loop_new" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:12: erreur: «error" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:12: erreur: «dbus_error_init" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:13: erreur: «DBUS_BUS_SESSION" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:13: erreur: «dbus_bus_get" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:15: erreur: «g_warning" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:16: erreur: «dbus_error_free" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:19: erreur: «dbus_connection_setup_with_g_main" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:21: erreur: «dbus_bus_add_match" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:22: erreur: «signal_filter" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:22: erreur: «dbus_connection_add_filter" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:23: erreur: «g_main_loop_run" was not declared in this scope
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c: At global scope:
/home/hamdi/Desktop/exempleconexion/exemple ping/dbus-ping-listen.c:26: erreur: «DBusHandlerResult" does not name a type
Process terminated with status 1 (0 minutes, 1 seconds)
25 errors, 0 warnings :shock:

i must insert pkg-config --libs --cflags dbus-1 dbus-glib-1 glib-2.0 somewher but i dont know where :?
Help please
thanks

Biplab

Add
pkg-config --cflags dbus-1 dbus-glib-1 glib-2.0
to Project > Compiler settings > Other options.

Then add
pkg-config --libs dbus-1 dbus-glib-1 glib-2.0
to Project > Other linker options.

That should solve your problem. :)
Be a part of the solution, not a part of the problem.

Metallica

i didnt find "compiler setting" in the project onglet :?
i use code blocks svn build rev 4439!!
what is the problem :(!!!

Biplab

Quote from: Metallica on October 10, 2007, 01:03:19 PM
i didnt find "compiler setting" in the project onglet :?
i use code blocks svn build rev 4439!!
what is the problem :(!!!

Translate Compiler settings to your language and then look for it. I don't speak your language and I can help you in English only. :)
Be a part of the solution, not a part of the problem.

Metallica

Quote from: Biplab on October 10, 2007, 01:27:15 PM
Quote from: Metallica on October 10, 2007, 01:03:19 PM
i didnt find "compiler setting" in the project onglet :?
i use code blocks svn build rev 4439!!
what is the problem :(!!!

Translate Compiler settings to your language and then look for it. I don't speak your language and I can help you in English only. :)

no!!! i has an english version!! but in the onglet "project " there is no compiler setting for exemple!!
anyway i found it insettings >compiler and debugger>compiler setings> other option  :o
the problem now is that after i put the options i can't save it!!!!!
starnge!!!but i cant save the modification!!
any idea?!

Biplab

Arrgh.. I missed to write intermediate steps. :x

It should be-
Add
`pkg-config --cflags dbus-1 dbus-glib-1 glib-2.0`
to Project > Build options > Compiler settings > Other options.

Then add
`pkg-config --libs dbus-1 dbus-glib-1 glib-2.0`
to Project > Build options > Linker settings > Other linker options.

I'm very sorry for the missed steps. And don't forget to add the backticks '`'. :)

Don't add them to Settings > Compilers and debuggers section as they will affect all other projects.
Be a part of the solution, not a part of the problem.