Я сталкиваюсь с ошибками при исправлении DWM, кое-что об определении функции здесь не разрешено - PullRequest
0 голосов
/ 17 июня 2019

Я пытаюсь получить systray в dwm. DWM - это динамический оконный менеджер Suckless для X: https://dwm.suckless.org/. Чтобы настроить dwm, вам нужно вручную добавить патчи. Я сделал git-репозиторий, содержащий все файлы, расположенные по адресу https://github.com/domianter34/dwm/tree/master/dwm,, но проблема, похоже, связана только с файлом dwm.c. Также в репозиторий git, который я добавил, я включил все патчи, которые когда-либо добавлял, поэтому я не применил патч к стоковой dwm. Также я собираю это на FreeBSD, но я думаю, что ОС не имеет значения в контексте этого вопроса. Заранее спасибо.

Я не знаю в первую очередь о программировании на 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

Я хочу, чтобы он успешно компилировался с примененными исправлениями, чтобы я мог использовать systray.

1 Ответ

1 голос
/ 17 июня 2019

Первая ошибка, которую я вижу:

Относительно:

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 '}'
...