我正在尝试创建一个面板小程序,但我被困在第一步:我已经使用来自http://developer.gnome.org/panel-applet/的官方示例的代码创建了一个 file.cpp 3.0/getting-started.example.html
#include <gtk/gtk.h>
#include <panel-applet.h>
static gboolean
hello_world_applet_start (PanelApplet *applet)
{
GtkWidget *label;
label = gtk_label_new ("Hello World");
gtk_container_add (GTK_CONTAINER (applet), label);
gtk_widget_show_all (GTK_WIDGET (applet));
return TRUE;
}
static gboolean
hello_world_factory_callback (PanelApplet *applet,
const gchar *iid,
gpointer data)
{
gboolean retval = FALSE;
if (g_strcmp0 (iid, "HelloWorldApplet") == 0)
retval = hello_world_applet_start (applet);
return retval;
}
PANEL_APPLET_OUT_PROCESS_FACTORY ("HelloWorldFactory",
PANEL_TYPE_APPLET,
hello_world_factory_callback,
NULL)
编译
g++ -Wall -DGTK_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE `pkg-config --cflags --libs gtk+-3.0 libpanelapplet-4.0` *.cpp -o helloworld
并复制到
/usr/lib/gnome-panel/helloworld
然后我创建了文件
/usr/share/gnome-panel/4.0/applets/helloworld.panel-applet
包含以下内容:
[Applet Factory]
Id=HelloWorldFactory
InProcess=true
Location=/usr/lib/gnome-panel/helloworld
Name=Hello World Applet Factory
Description=Factory for the window navigation related applets
[HelloWorldApplet]
Name=Hello World
Description=Factory for the Hello World applet example
Icon=hello-world-icon
所有代码均取自文档,但是当我尝试将小程序添加到面板时出现此错误:
** (gnome-panel:24803): WARNING **: Failed to load applet HelloWorldFactory::HelloWorldApplet: /usr/lib/gnome-panel/helloworld: cannot dynamically load executable
怎么了??