[packagekit] Problem running example from FAQ
Dorian Perkins
dperkins at google.com
Tue Aug 5 15:57:21 PDT 2008
Hello Again,
After some help in #packagekit (thanks to james_w), I am currently using the
following compile command:
gcc $(pkg-config --cflags dbus-glib-1) installer.c
just for clarity, $(pkg-config --cflags dbus-glib-1) resolves to:
-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
I am currently getting the following compile time errors:
installer.c:9: warning: data definition has no type or storage class
installer.c:9: error: conflicting types for 'connection'
installer.c:4: error: previous declaration of 'connection' was here
installer.c:9: warning: initialization makes integer from pointer without a
cast
installer.c:9: error: initializer element is not constant
installer.c:10: warning: data definition has no type or storage class
installer.c:10: error: conflicting types for 'proxy'
installer.c:5: error: previous declaration of 'proxy' was here
installer.c:13: warning: passing argument 1 of 'dbus_g_proxy_new_for_name'
makes pointer from integer without a cast
installer.c:13: warning: initialization makes integer from pointer without a
cast
installer.c:13: error: initializer element is not constant
installer.c:15: warning: data definition has no type or storage class
installer.c:17: warning: passing argument 1 of 'dbus_g_proxy_call' makes
pointer from integer without a cast
installer.c:17: error: initializer element is not constant
installer.c:18: error: expected identifier or '(' before 'if'
It seems that the *gboolean* 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:
#include <glib.h>
Any help would be greatly appreciated!
P.S. On a side note, the python example at
http://www.packagekit.org/pk-faq.html#session-methods works just fine. Not
sure why I am having so much trouble getting the C example to work.
Best,
Dorian
On Tue, Aug 5, 2008 at 2:33 PM, Dorian Perkins <dperkins at google.com> wrote:
> Hello All,
>
> 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.
>
> "
>
> #include <dbus/dbus-glib.h>
>
> DBusGConnection *connection;
> DBusGProxy *proxy;
> GError *error = NULL;
> gboolean ret;
>
> connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
> proxy = dbus_g_proxy_new_for_name (connection,
>
> "org.freedesktop.PackageKit",
> "/org/freedesktop/PackageKit",
> "org.freedesktop.PackageKit");
> /* execute sync method */
>
> ret = dbus_g_proxy_call (proxy, "InstallPackageName", &error,
> G_TYPE_STRING, "openoffice-clipart",
> G_TYPE_INVALID, G_TYPE_INVALID);
> if (!ret) {
>
> g_warning ("failed: %s", error->message);
> g_error_free (error);
> }
>
> "
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20080805/f9a9d092/attachment-0003.htm>
More information about the PackageKit
mailing list