title: Running x11 on Mac OS
body: <p>I have properly installed the <code>XQuarts.app</code> but have the linking phase problem. <br> 
  Here is the simple code.<br></p>
  
  <pre><code>#include &lt;X11/Xlib.h&gt;
  #include &lt;X11/Xutil.h&gt;
  #include &lt;X11/Xresource.h&gt;
  
  int main() {
      Display* dis = XOpenDisplay(NULL);
      return 0;
  }
  </code></pre>
  
  <p>When i compile it from XQuartz.app like this </p>
  
  <blockquote>
    <p>g++ -c main.cpp -I/opt/X11/include<br></p>
  </blockquote>
  
  <p>However it outputs:</p>
  
  <blockquote>
    <p>Undefined symbols for architecture x86_64:
      "_XOpenDisplay", referenced from:
          _main in main.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [default] Error 1</p>
  </blockquote>
  
  <p>My mac version:</p>
  
  <blockquote>
    <p>Yosemite 10.10.2</p>
  </blockquote>
  
  <p>I googled a lot but couldn't find any useful help. Thanks in advance.</p>