- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我可能在这里遗漏了一些非常基本的东西,但由于某种原因,我无法在我的 Ubuntu 20.04 系统上成功链接 libnotify,即使一切都已正确安装并且 pkg-cfg(恕我直言)返回正确的选项......任何想法?
user@home:~/jabrac$ ldconfig -v | grep notify
libnotify.so.4 -> libnotify.so.4.0.0
user@home:~/jabrac$ dpkg -L libnotify-dev
/.
/usr
/usr/include
/usr/include/libnotify
/usr/include/libnotify/notification.h
/usr/include/libnotify/notify-enum-types.h
/usr/include/libnotify/notify-features.h
/usr/include/libnotify/notify.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/libnotify.pc
/usr/share
/usr/share/doc
/usr/share/doc/libnotify-dev
/usr/share/doc/libnotify-dev/copyright
/usr/share/gir-1.0
/usr/share/gir-1.0/Notify-0.7.gir
/usr/lib/x86_64-linux-gnu/libnotify.so
/usr/share/doc/libnotify-dev/changelog.Debian.gz
user@home:~/jabrac$ ls -l /usr/lib/x86_64-linux-gnu/libnotify.so*
lrwxrwxrwx 1 root root 14 Mär 20 2020 /usr/lib/x86_64-linux-gnu/libnotify.so -> libnotify.so.4
lrwxrwxrwx 1 root root 18 Mär 20 2020 /usr/lib/x86_64-linux-gnu/libnotify.so.4 -> libnotify.so.4.0.0
-rw-r--r-- 1 root root 38984 Mär 20 2020 /usr/lib/x86_64-linux-gnu/libnotify.so.4.0.0
user@home:~/jabrac$ cat hello_world.c
#include <libnotify/notify.h>
#include <stdio.h>
int main(int argc, char * argv[] )
{
notify_init("Sample");
NotifyNotification* n = notify_notification_new ("Hello world",
"some message text... bla bla",
0);
notify_notification_set_timeout(n, 10000); // 10 seconds
if (!notify_notification_show(n, 0))
{
printf("show has failed\n");
return -1;
}
return 0;
}
user@home:~/jabrac$ gcc `pkg-config --cflags --libs libnotify` hello_world.c
/usr/bin/ld: /tmp/cckbaX1n.o: in function `main':
hello_world.c:(.text+0x1b): undefined reference to `notify_init'
/usr/bin/ld: hello_world.c:(.text+0x33): undefined reference to `notify_notification_new'
/usr/bin/ld: hello_world.c:(.text+0x48): undefined reference to `notify_notification_set_timeout'
/usr/bin/ld: hello_world.c:(.text+0x59): undefined reference to `notify_notification_show'
collect2: error: ld returned 1 exit status
user@home:~/jabrac$ pkg-config --cflags --libs libnotify
-pthread -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lnotify -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
最佳答案
正如@Someprogrammerdude 上面所说,您需要在程序之后指定 -l 选项。这是 gcc(1) 手册页中的相关部分:
-llibrary
...
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, foo.o -lz bar.o searches library z after file foo.o but before bar.o. If bar.o refers to functions in z, those functions may not be loaded.
关于c - 简单的 libnotify "hello world"程序无法在 Ubuntu 20.04 上编译并出现链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70195279/
我正在尝试在 gnome 中创建一个简单的通知,它会在单击时执行一些代码。我在下面的代码编译并运行,但单击通知气泡不会执行任何操作。我发现的所有代码示例都表明这应该有效。 #include #inc
我正在使用 libnotify在 Ubuntu 中显示通知的库。理想情况下,我想显示某种电池(因为我的应用程序是一个电池表)。 我可以使用的图标类型是: 指定图标文件名的 URI(例如 file://
有谁知道如何让通过通知发送发送的多个弹出窗口同时出现在屏幕上。 与: $ notify-send 'Message One' 'Body One' & notify-send 'Message Two
我正在尝试编写一些针对 libnotify 的代码,但是 perl 和 libnotify 的文档严重缺乏。那么,截至 2011 年 8 月 26 日,有没有比 libnotify“更好”的东西?我只
guard运行良好,直到突然出现,它向我抛出了这些错误: $bin/guard Could not open library 'libgtkmm-2.4': libgtkmm-2.4: cannot
notify-send显示一个通知框,其中包含您要在自己的计算机上显示的消息。 有没有办法使用notify-send向另一个用户发送通知消息并在他的机器上显示该消息? 最佳答案 Bash 可以写入网络
我正在尝试使用 python 和 Libnotify 开发桌面通知系统。 我找到了这个 tutorial并尝试了带有 Action 回调的示例,下面是我的代码修改 #initialization of
请注意:这不是涉及多头显示的听起来类似的常见问题解答。这个问题是关于两台不同的计算机。 如果我登录到两台不同计算机的控制台,sitting-at.example.com 和 sshed-into.ex
#include #include #include int main(int argc, char** argv) { if(argc == 3) { Noti
我正在使用 ubuntu 11.10 和 gnome-shell 3。我正在使用 Guard 来通知测试通过或失败。 当我在几秒钟后自动隐藏绿色测试通知但当我的测试出现错误时,我必须单击错误消息以隐藏
我不知道为什么 libnotify 停止显示有关已完成测试的信息。它显示 Spork 消息:“Rspec 已成功启动。”但在那之后没有显示任何东西。我正在使用 Ubuntu。 guard 'spork
我在带有 Rails 通知的自动测试中挖掘谷歌,发现这条指令很有用( http://jetpackweb.com/blog/2009/09/01/autotest-notifications-on-u
我可能在这里遗漏了一些非常基本的东西,但由于某种原因,我无法在我的 Ubuntu 20.04 系统上成功链接 libnotify,即使一切都已正确安装并且 pkg-cfg(恕我直言)返回正确的选项..
我有一个 Python 3 脚本,它从 URL 获取一些 JSON,对其进行处理,并在我获取的数据发生任何重大变化时通知我。我试过使用 notify2和 PyGObject的 libnotify 绑定
我正在关注 rails教程,但我是在服务器上做的。现在,我正在使用 Guard gem 来监视我的更改并执行测试。据我所知,如果测试失败或成功,它通常会使用 libnotify 通知我。 现在,我希望
我遇到了这个错误。知道有什么问题吗? from gi.repository import Notify Notify.init("App Name") Notify.Notification.new(
我是 ruby 新手,我想使用这个 pomo util:https://github.com/visionmedia/pomo#readme . 但是当我在我的 ubuntu 12.10 终端上执
我是一名优秀的程序员,十分优秀!