MinGW linking issue

This is a discussion on MinGW linking issue within the Windows Programming forums, part of the Platform Specific Boards category; My problem is a simple one - for some reason g++ does not find my libraries: g++ -LC:\avatar\boost_1_42\lib\ -oboost-test main.o ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    2

    [Solved] MinGW linking issue

    My problem is a simple one - for some reason g++ does not find my libraries:

    g++ -LC:\avatar\boost_1_42\lib\ -oboost-test main.o -lboost_filesystem-mgw34-mt-d
    c:/qt/sdk_2010.02.1/mingw/mingw32/bin/ld.exe: cannot find -lboost_filesystem-mgw34-mt-d

    However, in path
    C:\avatar\boost_1_42\lib
    there are following files (among other boost libs):
    libboost_filesystem-mgw34-mt-1_42.lib
    libboost_filesystem-mgw34-mt.lib
    libboost_filesystem-mgw34-mt-d-1_42.lib
    libboost_filesystem-mgw34-mt-d.lib

    As far as I can tell, those parameters given to g++ should be enough to find the last file in the list above. They aren't, however, and I am out of ideas here.


    My environment:
    Windows XP
    MinGW 4.4 that comes bundled with 2010.02.1 Qt SDK.
    Eclipse 3.5 with CDT
    Last edited by ascen; 03-31-2010 at 04:24 AM. Reason: Found a solution

  2. #2
    Registered User
    Join Date
    Mar 2010
    Posts
    2

    Solution

    Turns out the linker does not in fact treat .lib libraries in the same way as it does for .a and .so libraries.

    Specify the libraries for the linker to use | MinGW

    When using .lib libraries, the linking parameter must be
    -llib<name> instead of just -l<name>

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MinGW Compiling Issue
    By gesangbaer in forum C++ Programming
    Replies: 3
    Last Post: 12-10-2009, 08:41 PM
  2. Linking to MinGW lib from vs2005
    By Kennedy in forum Tech Board
    Replies: 4
    Last Post: 09-23-2009, 09:59 AM
  3. float calculation issue
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-26-2008, 04:56 AM
  4. Replies: 3
    Last Post: 04-16-2007, 12:02 PM
  5. MinGW Linking GUI Program
    By Tonto in forum Tech Board
    Replies: 19
    Last Post: 08-23-2006, 03:28 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21