title: C program cannot find function which included in header file
body: <p>I made program like this.</p>
  
  <pre><code>  1 #include &lt;stdio.h&gt;
    2 #include &lt;string.h&gt;
    3 #include &lt;stdlib.h&gt;
    4 #include "libavformat/avformat.h"
    5 
    6 int main (int argc, char* argv[]){
    7         av_register_all();
    8         return 0;
    9 }
  </code></pre>
  
  <p>My header file located in </p>
  
  <pre><code>root@ubuntu:/home/juneyoungoh/getDuration# find / -name "avformat.h"
  /root/ffmpeg/libavformat/avformat.h
  /usr/local/include/libavformat/avformat.h
  </code></pre>
  
  <p>then I run with <code>gcc getDuration.c</code> , but I show message like below.</p>
  
  <pre><code>root@ubuntu:/home/juneyoungoh/getDuration# gcc getDuration.c 
  /tmp/ccwjonqH.o: In function `main':
  getDuration.c:(.text+0x10): undefined reference to `av_register_all'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>Frankly, I do not have any idea what makes this.</p>
  
  <p>Thanks for your answers.</p>
  
  <p>========================== edited #1 ===========================</p>
  
  <p>when I "ls /usr/local/lib", I get this.</p>
  
  <pre><code>root@ubuntu:/home/juneyoungoh/getDuration# ls /usr/local/lib/
  libavcodec.a   libavutil.a    libopus.la       libvpx.a   python2.7
  libavdevice.a  libfdk-aac.a   libpostproc.a    libx264.a
  libavfilter.a  libfdk-aac.la  libswresample.a  libyasm.a
  libavformat.a  libopus.a      libswscale.a     pkgconfig
  </code></pre>
  
  <p>you can see libavformat.a in the very first of the last line.</p>
  
  <p>so if I command like what you suggest, I get below.</p>
  
  <pre><code>/root/ffmpeg/libavformat/vqf.c:244: undefined reference to `av_free_packet'
  /usr/local/lib//libavformat.a(vqf.o): In function `add_metadata':
  /root/ffmpeg/libavformat/vqf.c:58: undefined reference to `av_malloc'
  /root/ffmpeg/libavformat/vqf.c:64: undefined reference to `av_dict_set'
  /usr/local/lib//libavformat.a(vqf.o): In function `vqf_read_header':
  /root/ffmpeg/libavformat/vqf.c:148: undefined reference to `av_dict_set'
  /root/ffmpeg/libavformat/vqf.c:208: undefined reference to `av_log'
  /root/ffmpeg/libavformat/vqf.c:216: undefined reference to `av_malloc'
  /root/ffmpeg/libavformat/vqf.c:170: undefined reference to `av_log'
  /root/ffmpeg/libavformat/vqf.c:121: undefined reference to `av_log'
  /root/ffmpeg/libavformat/vqf.c:184: undefined reference to `av_log'
  /root/ffmpeg/libavformat/vqf.c:136: undefined reference to `av_log'
  /usr/local/lib//libavformat.a(wavenc.o): In function `wav_write_trailer':
  /root/ffmpeg/libavformat/wavenc.c:210: undefined reference to `av_rescale'
  /usr/local/lib//libavformat.a(wavenc.o): In function `wav_write_packet':
  /root/ffmpeg/libavformat/wavenc.c:181: undefined reference to `av_log'
  </code></pre>
  
  <p>It is too long, so I just post little part of that.</p>
  
  <p>I think all link of libavformat has been broken, But I do not know</p>
  
  <p>what can I do to fix that link.</p>
  
  <p>I have installed that their official link said.</p>
  
  <p><a href="https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideQuantal" rel="nofollow">https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideQuantal</a></p>