title: Undefine reference for libraries, so How could I find the right path?
body: <p>I am trying to compile a v4l2 example in Ubuntu but I am getting the following error:</p>
  
  <pre><code>guilherme@notedev01:~/Downloads/V4l2_samples-0.4.1$ make
  gcc -O2  -L/usr/include -lX11 -lXext -o viewer viewer.c
  /tmp/ccUjnjWQ.o: In function `image_destroy':
  viewer.c:(.text+0x234): undefined reference to `XDestroyImage'
  viewer.c:(.text+0x256): undefined reference to `XFreeGC'
  viewer.c:(.text+0x277): undefined reference to `XShmDetach'
  viewer.c:(.text+0x2ac): undefined reference to `XFreePixmap'
  /tmp/ccUjnjWQ.o: In function `image_create':
  viewer.c:(.text+0x305): undefined reference to `XCreateGC'
  viewer.c:(.text+0x31d): undefined reference to `XGetWindowAttributes'
  viewer.c:(.text+0x39e): undefined reference to `XShmCreateImage'
  viewer.c:(.text+0x3f5): undefined reference to `XShmAttach'
  viewer.c:(.text+0x44e): undefined reference to `XCreateImage'
  viewer.c:(.text+0x494): undefined reference to `XShmQueryExtension'
  viewer.c:(.text+0x4b4): undefined reference to `XShmPixmapFormat'
  viewer.c:(.text+0x4dc): undefined reference to `XShmCreatePixmap'
  /tmp/ccUjnjWQ.o: In function `image_put':
  viewer.c:(.text+0x54c): undefined reference to `XPutImage'
  viewer.c:(.text+0x586): undefined reference to `XShmPutImage'
  /tmp/ccUjnjWQ.o: In function `main':
  viewer.c:(.text.startup+0x18b): undefined reference to `XOpenDisplay'
  viewer.c:(.text.startup+0x1b1): undefined reference to `XScreenOfDisplay'
  viewer.c:(.text.startup+0x1ee): undefined reference to `XCreateSimpleWindow'
  viewer.c:(.text.startup+0x249): undefined reference to `XMapRaised'
  viewer.c:(.text.startup+0x263): undefined reference to `XStoreName'
  viewer.c:(.text.startup+0x280): undefined reference to `XGetWindowAttributes'
  viewer.c:(.text.startup+0x92f): undefined reference to `XPending'
  viewer.c:(.text.startup+0x94c): undefined reference to `XNextEvent'
  viewer.c:(.text.startup+0xaee): undefined reference to `XPending'
  viewer.c:(.text.startup+0xb0b): undefined reference to `XNextEvent'
  viewer.c:(.text.startup+0xf39): undefined reference to `XPending'
  viewer.c:(.text.startup+0xf56): undefined reference to `XNextEvent'
  collect2: error: ld returned 1 exit status
  make: *** [viewer] Error 1
  </code></pre>
  
  <p>What I can see is that the path for -lx11 and -lXext isn't -L/usr/include.
  How can I find the right path for those libraries? </p>
  
  <p>Thanks.</p>