<div dir="ltr">Hello Again,<br><br>After some help in #packagekit (thanks to james_w), I am currently using the following compile command:<br><br>gcc $(pkg-config --cflags dbus-glib-1) installer.c <br><br>just for clarity, $(pkg-config --cflags dbus-glib-1) resolves to:<br>
<br>-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include<br><br>I am currently getting the following compile time errors:<br><br>installer.c:9: warning: data definition has no type or storage class<br>
installer.c:9: error: conflicting types for 'connection'<br>installer.c:4: error: previous declaration of 'connection' was here<br>installer.c:9: warning: initialization makes integer from pointer without a cast<br>installer.c:9: error: initializer element is not constant<br>
installer.c:10: warning: data definition has no type or storage class<br>installer.c:10: error: conflicting types for 'proxy'<br>installer.c:5: error: previous declaration of 'proxy' was here<br>installer.c:13: warning: passing argument 1 of 'dbus_g_proxy_new_for_name' makes pointer from integer without a cast<br>
installer.c:13: warning: initialization makes integer from pointer without a cast<br>installer.c:13: error: initializer element is not constant<br>installer.c:15: warning: data definition has no type or storage class<br>installer.c:17: warning: passing argument 1 of 'dbus_g_proxy_call' makes pointer from integer without a cast<br>
installer.c:17: error: initializer element is not constant<br>installer.c:18: error: expected identifier or '(' before 'if'<br><br>It seems that the <b>gboolean</b> type declared is unknown. The code I am using is exactly what I previously quoted in my original email, except that I have added the following line to the very top of the file in an attempt to fix the error:<br>
<br>#include <glib.h><br><br>Any help would be greatly appreciated!<br><br>P.S. On a side note, the python example at <a href="http://www.packagekit.org/pk-faq.html#session-methods">http://www.packagekit.org/pk-faq.html#session-methods</a> works just fine. Not sure why I am having so much trouble getting the C example to work.<br>
<br>Best,<br><br>Dorian<br><br><div class="gmail_quote">On Tue, Aug 5, 2008 at 2:33 PM, Dorian Perkins <span dir="ltr"><<a href="mailto:dperkins@google.com">dperkins@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr">Hello All,<br><br>I am trying to run the following example from the PackageKit FAQ and I cannot get it to compile. What compilation flags should I be using? Are there any extra libraries (not standard with PackageKit) that I may need? Thanks.<br>
<br>"<br><pre>#include <dbus/dbus-glib.h><br><br>DBusGConnection *connection;<br>DBusGProxy *proxy;<br>GError *error = NULL;<br>gboolean ret;<br><br>connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);<br>proxy = dbus_g_proxy_new_for_name (connection,<br>
"org.freedesktop.PackageKit",<br> "/org/freedesktop/PackageKit",<br> "org.freedesktop.PackageKit");<br>/* execute sync method */<br>
ret = dbus_g_proxy_call (proxy, "InstallPackageName", &error,<br> G_TYPE_STRING, "openoffice-clipart",<br> G_TYPE_INVALID, G_TYPE_INVALID);<br>if (!ret) {<br>
g_warning ("failed: %s", error->message);<br> g_error_free (error);<br>}</pre>"<br></div>
</blockquote></div><br></div>