title: How to compile a APR test script
body: <p>Its a long time since I've used C but now I'm trying to compile a short script that gets server-stats from the Apache-Portable-Runtime (APR).</p>
  
  <p>Header files located at /usr/include/apr-1/apr*.h and libs are located at /usr/lib64/libapr-1.*</p>
  
  <p>Source files can be found on the official APR site <a href="http://apr.apache.org/docs/apr/1.3/files.html" rel="nofollow">http://apr.apache.org/docs/apr/1.3/files.html</a>.</p>
  
  <pre><code>/* test.c */
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;apr_general.h&gt;
  #include &lt;apr_time.h&gt;
  
  int main(int argc, const char *argv[])
  {
      apr_time_t t;
      t = apr_time_now();
      printf("The current time: %" APR_TIME_T_FMT "[us]\n", t);
      return 0;
  }
  </code></pre>
  
  <p>When I try and compile I get the following error (which I believe is a linking issue):</p>
  
  <pre>
  ~> gcc -Wall $(apr-1-config --cflags --cppflags --includes --link-ld) test.c -o test.bin
  /tmp/cc4DYD2W.o: In function `main':
  test.c:(.text+0x10): undefined reference to `apr_time_now'
  collect2: ld returned 1 exit status
  </pre>
  
  <p>My environment is gentoo:</p>
  
  <pre>
  ~> uname -a
  Linux alister 2.6.32.21-grsec-gt-r2 #1 SMP Tue Sep 7 23:54:49 PDT 2010\
  x86_64 Intel(R) Xeon(R) CPU L5640 @ 2.27GHz GenuineIntel GNU/Linux`
  ~> gcc -v 
  gcc version 4.3.4 (Gentoo 4.3.4 p1.1, pie-10.1.5)
  ~> emerge --search "%@^dev-lib.*apr"
  *  dev-libs/apr
     Latest version installed: 1.3.9
  *  dev-libs/apr-util
     Latest version installed: 1.3.9
  </pre>
  
  <p>Does anyone with more experience with C on Linux have any suggestions for me to get this working?</p>
  
  <p>As always thanks in advance.</p>