我正在尝试在dwm中获得系统托盘。 DWM是X的动态窗口管理器:https://dwm.suckless.org/。要配置dwm,您需要自己手动添加补丁。我制作了一个git repo,其中包含位于https://github.com/domianter34/dwm/tree/master/dwm的所有文件,但是问题似乎仅在于dwm.c文件。同样,在git repo中,我添加了我曾经添加的所有补丁,所以我没有针对stock dwm对其进行补丁。我也在FreeBSD上进行编译,但是我认为OS与这个问题无关。先感谢您。
我不知道有关C编程的第一件事,因此我为什么要在这里问。从我读到的有关错误的内容来看,似乎表明我在某处缺少括号,但从直线上也可以看出一切似乎井井有条。
这是确切的错误:
rm -f dwm drw.o dwm.o util.o dwm-6.2.tar.gz
dwm build options:
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -g -I/usr/local/include -I/usr/local/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION="6.2" -DXINERAMA
LDFLAGS = -L/usr/local/lib -lX11 -lXinerama -lfontconfig -lXft -lXrender
CC = cc
cc -c -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -g -I/usr/local/include -I/usr/local/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"6.2\" -DXINERAMA drw.c
cc -c -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -g -I/usr/local/include -I/usr/local/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"6.2\" -DXINERAMA dwm.c
dwm.c:796:10: warning: implicitly declaring library function 'snprintf' with type 'int (char *, unsigned long, const char *, ...)' [-Wimplicit-function-declaration]
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
^
dwm.c:796:10: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'
dwm.c:975:1: error: function definition is not allowed here
{
^
dwm.c:1001:1: error: function definition is not allowed here
{
^
dwm.c:1010:1: error: function definition is not allowed here
{
^
dwm.c:1025:1: error: function definition is not allowed here
{
^
dwm.c:1051:1: error: function definition is not allowed here
{
^
dwm.c:1075:1: error: function definition is not allowed here
{
^
dwm.c:1085:1: error: function definition is not allowed here
{
^
dwm.c:1103:1: error: function definition is not allowed here
{
^
dwm.c:1113:1: error: function definition is not allowed here
{
^
dwm.c:1138:1: error: function definition is not allowed here
{
^
dwm.c:1159:1: error: function definition is not allowed here
{
^
dwm.c:1177:1: error: function definition is not allowed here
{
^
dwm.c:1185:1: error: function definition is not allowed here
{
^
dwm.c:1196:1: error: function definition is not allowed here
{
^
dwm.c:1212:1: error: function definition is not allowed here
{
^
dwm.c:1228:1: error: function definition is not allowed here
{
^
dwm.c:1298:1: error: function definition is not allowed here
{
^
dwm.c:1308:1: error: function definition is not allowed here
{
^
dwm.c:1329:1: error: function definition is not allowed here
{
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
*** Error code 1
Stop.
make: stopped in /usr/home/dominic/Source/dwm
我想要的是它能够成功应用补丁程序进行编译,因此我可以使用系统托盘。
最佳答案
我看到的第一个错误:
关于:
void
expose(XEvent *e)
{
Monitor *m;
XExposeEvent *ev = &e->xexpose;
if (ev->count == 0 && (m = wintomon(ev->window))) {
drawbar(m);
if (m == selmon)
updatesystray();
}
仔细重写以暴露问题:
void
expose(XEvent *e)
{
Monitor *m;
XExposeEvent *ev = &e->xexpose;
if (ev->count == 0 && (m = wintomon(ev->window)))
{
drawbar(m);
if (m == selmon)
updatesystray();
}
// this is missing, right here, the final closing brace '}'