Libraries and Other Linker Inputs

VisualGDB uses the standard Linux way of specifying libraries used by the projects that relies on 3 different parameters:

  1. Library directories. These are the directories where the GNU linker will search for libraries specified in “Library names”. Locations like /usr/lib will be searched by default and do not need to be specified.
  2. Library names. This line contains short library names of libraries that should be linked with the project. The short library names do not contain the ‘lib’ prefix or the .a extension. E.g. in order to link with libpthread.a and libm.a this line should contain “pthread m”.
  3. Additional linker inputs. This line can specify full paths to additional library or object files that should be linked with the project. This can be used to link against a specific version of a library, e.g. /usr/lib/i386-linux-gnu/

It is recommended to specify libraries using the short names and directories, however if this causes problems (e.g. when using cross-compilation toolchains), it may be helpful to specify full paths to all necessary libraries using the “Additional Linker Inputs” line.

Diagnosing Linker Problems

You can force the linker to output a detailed log about the process of finding libraries. This can be accomplished by adding “-Wl,-verbose” to the linker command line (or using the “Verbose Mode” setting for MSBuild projects):Building the project with the -Wl,-verbose flag will produce a detailed output about each linker’s attempt to open a library: