title: g++ unable to link OpenAL Libraries
body: <p>I have trouble compiling the following code</p>
  
  <pre><code>#include &lt;AL/al.h&gt;
  #include &lt;AL/alc.h&gt;
  
  #include &lt;iostream&gt;
  
  
  int checkEnumerationSupport() {
  
      ALboolean enumeration;
  
      enumeration = alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT");
  
      if (enumeration == AL_FALSE) {
          // enumeration not supported
          std::cout &lt;&lt; "enumerating devices NOT supported\n";
      } else {
          // enumeration supported
          std::cout &lt;&lt; "enumerating devices supported\n";
      };
  
      return 0;
  
  }
  
  
  int main() {
  
      checkEnumerationSupport();
  
  }
  </code></pre>
  
  <p>using the command below.</p>
  
  <pre><code>g++ test.cpp -o test
  </code></pre>
  
  <p>I get the following message:</p>
  
  <pre><code>/tmp/ccEN7YAp.o: In function `checkEnumerationSupport()':
  test.cpp:(.text+0x13): undefined reference to `alcIsExtensionPresent'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>Realising the libraries weren't linked correctly, I tried changing the g++ line to</p>
  
  <pre><code>g++ -L/usr/lib/ test.cpp -o test -lal -lalc
  </code></pre>
  
  <p>giving me the following message:</p>
  
  <pre><code>/usr/bin/ld: cannot find -lal
  /usr/bin/ld: cannot find -lalc
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>I tested it on <strong>Linux Mint 17.2</strong> and <strong>Ubuntu 14.04</strong>.</p>
  
  <p>Does anyone know how to compile the code correctly?</p>