<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#CCCCCC" text="#000000">
    On 3/11/14 7:45 PM, Jason Blum wrote:<br>
    <blockquote
cite="mid:CAPJQkVVqoF98OMr_7OU9UjD05SRoTmWJQmeBP2-qcF1yEuo+TQ@mail.gmail.com"
      type="cite">
      <blockquote type="cite">
        <pre wrap="">Once you do that and you get linker errors, paste those
to pastebin and link here I guess.
</pre>
      </blockquote>
      <pre wrap="">
The order of the linking makes a difference between the types of
undefined reference errors that I'm getting.

If I use:

g++ -g -D__STDC_CONSTANT_MACROS -L/usr/local/lib/ -lswscale -lavformat
-lavcodec main.cpp

it results in the following: <a class="moz-txt-link-freetext" href="http://pastebin.com/LtJzA7Hj">http://pastebin.com/LtJzA7Hj</a>

If I use:

g++ main.cpp -g -D__STDC_CONSTANT_MACROS -L/usr/local/lib/ -lswscale
-lavformat -lavcodec

it results a 16000 line long error output too large for free PasteBin.
The abridged version: <a class="moz-txt-link-freetext" href="http://pastebin.com/8dsv2pMY">http://pastebin.com/8dsv2pMY</a>

I don't really understand linking order issues, but I would have
guessed at least one of the orders would have worked. If I don't
include the -D__STDC_CONST_MACROS flag, one of the header files
complains, so I think it is including the headers, which are in
/usr/local/include.

Any ideas what I'm missing?</pre>
    </blockquote>
    Compile the main.cpp into an object file first, and then, link order
    should be main.o and then all the libraries.<br>
    I am not sure about the behavior of the compiler in this case and I
    think that it should "do the right thing", but to guarantee the
    proper linking order, build main into an object file, then link them
    all with main.o as the first in the list.<br>
    <br>
    When linking, the linker maintains a master symbol table as it reads
    in objects and libraries.  Symbols from libraries are only included
    in the master symbol table if there have been prior references to
    them.  Symbols from object files are included automatically.  main.o
    will reference everything needed from the libraries.  So a linker
    call with main.o followed by a pkg-config --libs ffmpeg (see below)
    should stand up the appropriate linker line.<br>
    <br>
    Refer to doc/examples/Makefile. Here, simple example programs are
    built against ffmpeg libraries.  In this example, pkg-config is used
    to stand up the proper compiler and linker flags.  I'll admit, I
    don't know where in this makefile the actual compiler call is made,
    but notice how the makefile builds a list of object filenames.  In
    this makefile, pkg-config will find your systemwide installed .pc
    files, so if you wish to use locally built copy, .pc files are
    provided in a subdirectory of the installed location, and using
    pkg-config with an explicit path to these pc files "I believe" will
    let pkg-config stand up the args for your local ffmpeg libs.<br>
    <pre class="moz-signature" cols="72">-- 
Joshua Kordani
LSA Autonomy</pre>
  </body>
</html>