Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Generally, static libs do <em>not</em> generate object files. What you do is create object files and place them in a library, then the linker will search for the object files in those libraries.</p> <p>I'll explain from a UNIXy command line point of view since that's the simpler to understande (I have no idea what machinations VS does before doing the basic stuff).</p> <p>A sample command line for creating an executable is:</p> <pre><code>gcc -c -o prog.o prog.c gcc -o prog prog.o -L/libdir -lstdc </code></pre> <p>The first line simply creates an object file from your <code>C</code> file. The second line creates the executable by pulling object files together, generally following a rule set like:</p> <ul> <li>All <code>.o</code> file listed explicitly are linked.</li> <li>Once that's done, you search the libraries for other objects which satisfy referenced-but-undefined symbols.</li> </ul> <p>For example, say your <code>prog.c</code> contained the line <code>printf("hello\n");</code>. That will have resulted in your <code>prog.o</code> file containing a reference to <code>printf</code> that is not yet satisfied.</p> <p>The linker will search your specified libraries until it satisfies that reference. In this case it will search all files of the form <code>/libdir/libstdc.ext</code> where:</p> <ul> <li><code>/libdir</code> is from your <code>-L</code> option (a path to search for libraries in).</li> <li><code>/lib</code> is a constant.</li> <li><code>stdc</code> is the name of a library to search (from <code>-l</code>).</li> <li><code>ext</code> is one or more extensions (<code>.a, .so, .sl</code>, etc).</li> </ul> <p>Once the symbol is found, that object file is linked in to resolve it. This may result in <em>more</em> unsatisfied symbols appearing such as <code>/libdir/libstdc.a(printf.o)</code> having a reference to <code>/libdir/libstdc.a(putch.o)</code>.</p> <p>Your particular problem may be caused by the fact that you're trying to link the object file directly rather than searching the libraries. VS should have project options to specify object files, library search paths <em>and</em> library names (I'm not sure of this for the latest versions but I know earlier versions of MSVC did).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload