Revision of Specify the libraries for the linker to use from 2008, October 22 - 14:59

Printer-friendly version

  • How do I specify the libraries to be searched by the linker?
    • MinGW supports libraries named according to the `<name>.lib' and `<name>.dll' conventions, in addition to the normal `lib<name>.a' convention common on *nix systems. To include any libraries named according to any of these conventions, simply add the `-l<name>' switch to the compiler command, ensuring it is placed _after_ the name of the module in which the reference appears.
    • Note that, if the library is not found in any of the default library search paths, you may also need to insert a `-L<dir>' switch _before_ the `-l<name>' switch, to specify its location.
    • Also note that the library names `lib<name>.a' and `lib<name>.lib' _are not_ equivalent; if you have a library named according to the aberrant `lib<name>.lib' convention, it will not be found by specifying the `-l<name>' switch -- you must use the form `-llib<name>' instead.
This wiki is not a forum for discussion of usage issues. Please use the list instead. We do not allow creation of comments by anonymous or untrusted users, on any page.
Site Status

Site maintenance performed successfully, site online Dec 13th 12:00 AM Eastern.