title: How to compile a C code that uses GNU C extensions
body: <p>I want to use the function <code>__sync_lock_test_and_set</code> which is not available in ANSI c, but is an GNU C extension.</p>
  
  <p>When compile a piece of code which uses this extension, I get the following error,</p>
  
  <pre><code>/tmp/cc7Iat9G.o: In function `main':
  swap.c:(.text+0x40): undefined reference to `__sync_lock_test_set'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>So, what header file should I include, or what compiler flags should I give to compile a code with GNU C extensions</p>