title: compiling /usr/bin/ld undefined reference to XMapSubwindows and DSO missing from command line
body: <p>I'm trying to compile my patched dwm on Debian.</p>
  
  <p>This is my config.mk file, it's mostly the one from <code>apt source dwm</code> but the patches added some extra libraries, and I had to add the two -Ifreetype2 links myself:</p>
  
  <pre><code># dwm version
  VERSION = 6.1
  
  # Customize below to fit your system
  
  # paths
  PREFIX = /usr/local
  MANPREFIX = ${PREFIX}/share/man
  
  # Xinerama, comment if you don't want it
  XINERAMALIBS  = -lXinerama
  XINERAMAFLAGS = -DXINERAMA
  
  # freetype
  FREETYPELIBS = -lfontconfig -lXft
  FREETYPEINC = /usr/include/freetype2
  # OpenBSD (uncomment)
  #FREETYPEINC = ${X11INC}/freetype2
  
  # includes and libs
  INCS =  -I${X11INC} -I${FREETYPEINC} -I/usr/include/freetype2 -I/usr/include/libpng16
  LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}  -lXrender -lX11-xcb -lxcb -lxcb-res
  
  # flags
  CPPFLAGS += -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
  #CFLAGS   = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
  CFLAGS   += -std=c99 -pedantic -Wall -Wno-deprecated-declarations ${INCS} ${CPPFLAGS}
  LDFLAGS  += -s ${LIBS}
  
  # Solaris
  #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
  #LDFLAGS = ${LIBS}
  
  # compiler and linker
  CC = cc
  </code></pre>
  
  <p>This is the error I get when running <code>make clean install</code></p>
  
  <pre><code>cc -o dwm drw.o dwm.o util.o -s -L -lX11 -lXinerama -lfontconfig -lXft  -lXrender -lX11-xcb -lxcb -lxcb-res
  /usr/bin/ld: dwm.o: undefined reference to symbol 'XMapSubwindows'
  /usr/bin/ld: //lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
  collect2: error: ld returned 1 exit status
  make: *** [Makefile:29: dwm] Error 1
  </code></pre>
  
  <p>But I have no idea how to fix this. Do I need a library installed? do I need to add somthing to the libs variable? please help!</p>
  
  <p>I have tried looking at <a href="https://stackoverflow.com/questions/19901934/libpthread-so-0-error-adding-symbols-dso-missing-from-command-line">this</a>, but I have no idea what a "DSO" is, nor how to fix the linkage.</p>