You are not logged in.
Hello,
I am running dwm, and I love how simple and light it is. I edited my config.h few times and compiled it and it was fine. The last time I tried, it gave me an error. I could not figure that out. I tried to use a valid config.h from the internet in case I missed my config.h up, and I tried to re-install it. Nothing worked. This is the error that I get when I run the command makepkg -efi --noconfirm:
dwm build options:
CFLAGS = -std=c99 -pedantic -Wall -Os -I. -I/usr/include -I/usr/include/X11 -D_FORTIFY_SOURCE=2 -DVERSION="6.0" -DXINERAMA
LDFLAGS = -s -L/usr/lib -lc -L/usr/lib/X11 -lX11 -L/usr/lib/X11 -lXinerama
CC = cc
CC dwm.c
In file included from dwm.c:288:0:
config.h:18:19: error: ‘MAXTAGLEN’ undeclared here (not in a function)
const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "w" };
^
In file included from dwm.c:288:0:
config.h: In function ‘focusstackf’:
config.h:132:9: error: ‘sel’ undeclared (first use in this function)
if(!sel)
^
config.h:132:9: note: each undeclared identifier is reported only once for each function it appears in
config.h:134:8: error: ‘lt’ undeclared (first use in this function)
if(lt[sellt]->arrange) {
^
config.h:134:11: error: ‘sellt’ undeclared (first use in this function)
if(lt[sellt]->arrange) {
^
config.h:138:25: error: ‘clients’ undeclared (first use in this function)
for(c = clients; c && (!ISVISIBLE(c) || c->isfloating == sel->isfloating); c = c->next);
^
config.h:152:9: error: too few arguments to function ‘restack’
restack();
^
dwm.c:213:13: note: declared here
static void restack(Monitor *m);
^
In file included from dwm.c:288:0:
config.h: In function ‘setltor1’:
config.h:162:16: error: ‘lt’ undeclared (first use in this function)
setlayout((lt[sellt] == arg->v) ? &a : arg);
^
config.h:162:19: error: ‘sellt’ undeclared (first use in this function)
setlayout((lt[sellt] == arg->v) ? &a : arg);
^
config.h: In function ‘toggletorall’:
config.h:169:8: error: ‘sel’ undeclared (first use in this function)
if(sel && ((arg->ui & TAGMASK) == sel->tags)) {
^
config.h: In function ‘togglevorall’:
config.h:181:8: error: ‘sel’ undeclared (first use in this function)
if(sel && ((arg->ui & TAGMASK) == tagset[seltags])) {
^
config.h:181:39: error: ‘tagset’ undeclared (first use in this function)
if(sel && ((arg->ui & TAGMASK) == tagset[seltags])) {
^
config.h:181:46: error: ‘seltags’ undeclared (first use in this function)
if(sel && ((arg->ui & TAGMASK) == tagset[seltags])) {
^
config.h: In function ‘vieworprev’:
config.h:193:34: error: ‘tagset’ undeclared (first use in this function)
view(((arg->ui & TAGMASK) == tagset[seltags]) ? &a : arg);
^
config.h:193:41: error: ‘seltags’ undeclared (first use in this function)
view(((arg->ui & TAGMASK) == tagset[seltags]) ? &a : arg);
^
config.h: In function ‘warptosel’:
config.h:200:8: error: ‘sel’ undeclared (first use in this function)
if(sel)
^
config.h: In function ‘zoomf’:
config.h:208:8: error: ‘sel’ undeclared (first use in this function)
if(sel && (lt[sellt]->arrange != tile || sel->isfloating))
^
config.h:208:16: error: ‘lt’ undeclared (first use in this function)
if(sel && (lt[sellt]->arrange != tile || sel->isfloating))
^
config.h:208:19: error: ‘sellt’ undeclared (first use in this function)
if(sel && (lt[sellt]->arrange != tile || sel->isfloating))
^
config.h: At top level:
config.h:213:2: error: expected identifier or ‘(’ before ‘{’ token
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
^
config.h:213:78: error: expected identifier or ‘(’ before ‘,’ token
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
^
config.h:214:78: error: expected identifier or ‘(’ before ‘,’ token
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
^
config.h:215:78: error: expected identifier or ‘(’ before ‘,’ token
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
^
config.h:216:78: error: expected identifier or ‘(’ before ‘,’ token
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
^
config.h:222:145: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
^
config.h:223:20: error: redefinition of ‘termcmd’
static const char *termcmd[] = { "uxterm", NULL };
^
config.h:63:20: note: previous definition of ‘termcmd’ was here
static const char *termcmd[] = { "uxterm", NULL };
^
config.h:225:12: error: redefinition of ‘keys’
static Key keys[] = {
^
config.h:65:12: note: previous definition of ‘keys’ was here
static Key keys[] = {
^
config.h:264:15: error: redefinition of ‘buttons’
static Button buttons[] = {
^
config.h:96:15: note: previous definition of ‘buttons’ was here
static Button buttons[] = {
^
dwm.c: In function ‘createmon’:
dwm.c:654:15: error: ‘nmaster’ undeclared (first use in this function)
m->nmaster = nmaster;
^
dwm.c: In function ‘keypress’:
dwm.c:1087:2: warning: ‘XKeycodeToKeysym’ is deprecated (declared at /usr/include/X11/Xlib.h:1695) [-Wdeprecated-declarations]
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
^
In file included from dwm.c:288:0:
dwm.c: At top level:
config.h:15:13: warning: ‘readin’ defined but not used [-Wunused-variable]
static Bool readin = True; /* False means do not read stdin */
^
In file included from dwm.c:288:0:
config.h:65:12: warning: ‘keys’ defined but not used [-Wunused-variable]
static Key keys[] = {
^
config.h:96:15: warning: ‘buttons’ defined but not used [-Wunused-variable]
static Button buttons[] = {
^
make: *** [dwm.o] Error 1
==> ERROR: A failure occurred in build().
Aborting...And this is my config.h
/* See LICENSE file for copyright and license details. */
/* appearance */
static const char font[] = "-*-terminus-bold-r-normal-*-14-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#cccccc";
static const char normbgcolor[] = "#eeeeee";
static const char normfgcolor[] = "#000000";
static const char selbordercolor[] = "#0066ff";
static const char selbgcolor[] = "#eeeeee";
static const char selfgcolor[] = "#0066ff";
static unsigned int borderpx = 3; /* border pixel of windows */
static unsigned int snap = 32; /* snap pixel */
static Bool showbar = True; /* False means no bar */
static Bool topbar = True; /* False means bottom bar */
static Bool readin = True; /* False means do not read stdin */
/* tagging */
const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "w" };
static Rule rules[] = {
/* class instance title tags mask isfloating monitor */
{ "acme", NULL, NULL, 1 << 2, False, -1 },
{ "Acroread", NULL, NULL, 0, True, -1 },
{ "Gimp", NULL, NULL, 0, True, -1 },
{ "GQview", NULL, NULL, 0, True, -1 },
{ "MPlayer", NULL, NULL, 0, True, -1 },
{ "Navigator", NULL, NULL, 1 << 5, False, -1 },
};
/* layout(s) */
static float mfact = 0.65;
static Bool resizehints = False; /* False means respect size hints in tiled resizals */
static Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "< >", NULL }, /* no layout function means floating behavior */
{ "[ ]", monocle },
};
/* custom functions declarations */
static void focusstackf(const Arg *arg);
static void setltor1(const Arg *arg);
static void toggletorall(const Arg *arg);
static void togglevorall(const Arg *arg);
static void vieworprev(const Arg *arg);
static void warptosel(const Arg *arg);
static void zoomf(const Arg *arg);
/* key definitions */
#define MODKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, vieworprev, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, togglevorall, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletorall, {.ui = 1 << TAG} },
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[] = { "uxterm", NULL };
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstackf, {.i = +1 } },
{ MODKEY, XK_j, warptosel, {0} },
{ MODKEY, XK_k, focusstackf, {.i = -1 } },
{ MODKEY, XK_k, warptosel, {0} },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_Return, zoomf, {0} },
{ MODKEY, XK_Return, warptosel, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_space, setltor1, {.v = &layouts[0]} },
{ MODKEY|ShiftMask, XK_space, setltor1, {.v = &layouts[2]} },
{ MODKEY, XK_0, vieworprev, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_w, 5)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
};
/* button definitions */
/* click can ClkTagBar, ClkTagButton,
* ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setltor1, {.v = &layouts[0]} },
{ ClkLtSymbol, 0, Button2, setmfact, {.f = 1.65} },
{ ClkLtSymbol, 0, Button3, setltor1, {.v = &layouts[2]} },
{ ClkLtSymbol, 0, Button4, setmfact, {.f = +0.05} },
{ ClkLtSymbol, 0, Button5, setmfact, {.f = -0.05} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkStatusText, Button3Mask, Button1, killclient, {0} },
{ ClkWinTitle, 0, Button1, warptosel, {0} },
{ ClkWinTitle, 0, Button1, movemouse, {0} },
{ ClkWinTitle, 0, Button2, zoomf, {0} },
{ ClkWinTitle, 0, Button3, resizemouse, {0} },
{ ClkWinTitle, 0, Button4, focusstackf, {.i = -1 } },
{ ClkWinTitle, 0, Button5, focusstackf, {.i = +1 } },
{ ClkRootWin, 0, Button1, warptosel, {0} },
{ ClkRootWin, 0, Button1, movemouse, {0} },
{ ClkRootWin, 0, Button3, resizemouse, {0} },
{ ClkRootWin, 0, Button4, focusstackf, {.i = -1 } },
{ ClkRootWin, 0, Button5, focusstackf, {.i = +1 } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, zoomf, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, vieworprev, {0} },
{ ClkTagBar, 0, Button3, togglevorall, {0} },
{ ClkTagBar, 0, Button4, focusstackf, {.i = -1 } },
{ ClkTagBar, 0, Button5, focusstackf, {.i = +1 } },
{ ClkTagBar, Button2Mask, Button1, tag, {0} },
{ ClkTagBar, Button2Mask, Button3, toggletorall, {0} },
};
/* custom functions */
void
focusstackf(const Arg *arg) {
Client *c = NULL, *i;
if(!sel)
return;
if(lt[sellt]->arrange) {
if (arg->i > 0) {
for(c = sel->next; c && (!ISVISIBLE(c) || c->isfloating != sel->isfloating); c = c->next);
if(!c)
for(c = clients; c && (!ISVISIBLE(c) || c->isfloating == sel->isfloating); c = c->next);
}
else {
for(i = clients; i != sel; i = i->next)
if(ISVISIBLE(i) && i->isfloating == sel->isfloating)
c = i;
if(!c)
for(i = sel; i; i = i->next)
if(ISVISIBLE(i) && i->isfloating != sel->isfloating)
c = i;
}
}
if(c) {
focus(c);
restack();
}
else
focusstack(arg);
}
void
setltor1(const Arg *arg) {
Arg a = {.v = &layouts[1]};
setlayout((lt[sellt] == arg->v) ? &a : arg);
}
void
toggletorall(const Arg *arg) {
Arg a;
if(sel && ((arg->ui & TAGMASK) == sel->tags)) {
a.ui = ~0;
tag(&a);
}
else
toggletag(arg);
}
void
togglevorall(const Arg *arg) {
Arg a;
if(sel && ((arg->ui & TAGMASK) == tagset[seltags])) {
a.ui = ~0;
view(&a);
}
else
toggleview(arg);
}
void
vieworprev(const Arg *arg) {
Arg a = {0};
view(((arg->ui & TAGMASK) == tagset[seltags]) ? &a : arg);
}
void
warptosel(const Arg *arg) {
XEvent ev;
if(sel)
XWarpPointer(dpy, None, sel->win, 0, 0, 0, 0, 0, 0);
XSync(dpy, False);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
void
zoomf(const Arg *arg) {
if(sel && (lt[sellt]->arrange != tile || sel->isfloating))
togglefloating(NULL);
else
zoom(NULL);
}
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[] = { "uxterm", NULL };
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
};
/* button definitions */
/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};Any suggestions?
Last edited by husainaloos (2013-05-07 16:31:16)
Offline
Yes: don't cut and paste random stuff into your config.h until you know what it does...
The errors the compiler is printing tell you exactly in config.h where you have introduced stuff that shouldn't be there. Remove those entries and it should compile without issue (assuming that you haven't adopted a similar approach with dwm.c and neglected to mention it).
Offline
I reinstalled it from the source files. I think I was missing some graphical libraries that I didn't include in the config.h file. Thanks though.
Offline
No, you were not missing "some graphical libraries that you didn't incluce in the config.h file". It looks like, as jasonwryan said, you copied functions into your config.h without checking how they work. Thus, you ended up having functions that use variables you never define in config.h (and there's alot of those!)
Next time, either stick to already working patches found at suckless.org, or give some effort and at least try to figure out what is wrong with the code you randomly copied.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline