Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h3>Failure to link against appropriate libraries/object files or compile implementation files</h3> <p>Commonly, each translation unit will generate an object file that contains the definitions of the symbols defined in that translation unit. To use those symbols, you have to link against those object files.</p> <p>Under <strong>gcc</strong> you would specify all object files that are to be linked together in the command line, or compile the implementation files together.</p> <pre><code>g++ -o test objectFile1.o objectFile2.o -lLibraryName </code></pre> <p>The <code>libraryName</code> here is just the bare name of the library, without platform-specific additions. So e.g. on Linux library files are usually called <code>libfoo.so</code> but you'd only write <code>-lfoo</code>. On Windows that same file might be called <code>foo.lib</code>, but you'd use the same argument. You might have to add the directory where those files can be found using <code>-L‹directory›</code>. Make sure to not write a space after <code>-l</code> or <code>-L</code>.</p> <p>For <strong>XCode</strong>: Add the User Header Search Paths -> add the Library Search Path -> drag and drop the actual library reference into the project folder.</p> <p>Under <strong>MSVS</strong>, files added to a project automatically have their object files linked together and a <code>lib</code> file would be generated (in common usage). To use the symbols in a separate project, you'd need to include the <code>lib</code> files in the project settings. This is done in the Linker section of the project properties, in <code>Input -&gt; Additional Dependencies</code>. (the path to the <code>lib</code> file should be added in <code>Linker -&gt; General -&gt; Additional Library Directories</code>) When using a third-party library that is provided with a <code>lib</code> file, failure to do so usually results in the error.</p> <p>It can also happen that you forget to add the file to the compilation, in which case the object file won't be generated. In <strong>gcc</strong> you'd add the files to the command line. In <strong>MSVS</strong> adding the file to the project will make it compile it automatically (albeit files can, manually, be individually excluded from the build).</p> <p>In Windows programming, the tell-tale sign that you did not link a necessary library is that the name of the unresolved symbol begins with <code>__imp_</code>. Look up the name of the function in the documentation, and it should say which library you need to use. For example, MSDN puts the information in a box at the bottom of each function in a section called "Library".</p>
 

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