0

I am trying to get a systray in dwm. DWM is suckless's dynamic window manager for X: https://dwm.suckless.org/. To configure dwm you need to manually add in the patches yourself. I made a git repo containing all the files, located at https://github.com/domianter34/dwm/tree/master/dwm, but the issue only seems to be with the dwm.c file. Also in the git repo I added I included all the patches I have ever added, so I did not patch it against stock dwm. Also I am compiling this on FreeBSD, but I think the OS is irrelevant in the context of this question. Thank you in advance.

I do not know the first thing about C programming, hence why I am asking here. From what I have read about the error it seems to indicate that I am missing a bracket somewhere, but at the line it points me too everything seems to be in order.

Here is the exact error:

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

What I want is for it to compile successfully with the patches applied so I can use the systray.

dbush
  • 205,898
  • 23
  • 218
  • 273
  • OT: please do not use tabs for indenting, especially when mixed with spaces. The resulting code, when displayed in an editor is a mis-mash of indenting, depending on how wide a 'tab' is set to display in the editor – user3629249 Jun 17 '19 at 14:49
  • OT: variable names (and parameter names) should indicate `content` or `usage` (or better, both) one, two, or three character names are meaningless, even in the current context – user3629249 Jun 17 '19 at 14:52
  • Here is a prime example of why to NOT post links to code Just 12 months after this question was written, the linked value in `gethub` has been removed. – user3629249 Jun 12 '20 at 16:44

1 Answers1

2

The first error I see:

Regarding:

void
expose(XEvent *e)
{
    Monitor *m;
    XExposeEvent *ev = &e->xexpose;

    if (ev->count == 0 && (m = wintomon(ev->window))) { 
        drawbar(m);
        if (m == selmon)
                   updatesystray();
}

sightly rewritten to expose the problems:

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 '}'
user3629249
  • 16,402
  • 1
  • 16
  • 17