Boost logo

Boost Users :

From: Merrill Cornish (merrill.cornish_at_[hidden])
Date: 2005-12-15 13:21:50


Imran,

I've using Boost 1.33.0 with the latest MinGW on Windows XP, and it works fine.

Could you be a bit more specific as to why MinGW "can't use" the Boost libraries?
Do you mean that references are left unresolved?

Here is an excerpt from the part of my my Makefile that deals with libraries:

BOOSTLIBS = -L${boost_libs} \
            -llibboost_date_time${boost_suffix} \
            -llibboost_filesystem${boost_suffix} \
            -llibboost_regex${boost_suffix} \
            -llibboost_serialization${boost_suffix} \
            -llibboost_thread${boost_suffix} \
            -llibboost_program_options${boost_suffix}

where ${boost_libs} expands into the pathname of the directory the Boost
libraries are in and ${boost_suffix} expands into "-mgw-mt-sd-1_33", which
says the libraries are compiled for MinGW, multi-threaded, static, debug, and
Boost version 1.33.

I put ${BOOSTLIBS} as the LAST thing on the call to g++ to link my .exe
file. Notice that the positioning is important.

The linker reads the files listed on the command line from left to right.
When it comes to a library file, it resolves whatever outstanding references
to that library it has AT THAT POINT in the scan. If it sees another reference
to that library later in the left to right scan after seeing the library, that later
reference goes unresolved.

The linker needs to see ALL references to library functions BEFORE it
sees the libraries themselves. So, put the libraries last.

The Boost library build process creates the libraries both with the Boost
version suffix ("1_33" in my case) and without. You can use either one as
they are identical files.

The idea is that if you use the library file versions WITHOUT the version
number suffix, then you won't have to change your Makefile when a new
version comes out. On the other hand, if you want to explicitly tie your
program to one and only one version of the Boost libraries, you can use the
filename WITH the version numbers.

Merrill


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net