|
Boost Users : |
Subject: Re: [Boost-users] Boost Unit Testing Macros on Visual Studio 2005/Visual C++ 8.0
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-12-10 09:07:23
MSVC has a pragma-statement which causes the linker to atomatically link the
lib. Boost Test (as well as other boost libs, which are not only header
based) make use of this feature. Dependent on retrieved compiler settings
they calculate the name of the library to be linked and pass it to the
pragma-statement smth. like:
#pragma comment(lib, "lib-boost-test-whatever")
This causes the linker to atomatically link that library, the only
prerequisite is that it needs to find the path, where this lib can be
located. That's why you need to set Library Search Directory for VC.
Additioanlly, you can set this path globally in VC or locally only project
based. I usually do it locally and use the BOOST_ROOT environment variable.
That allows me to change the envvar and switch the path without changing the
VC project file (which might be under source control).
Regards,
Ovanes
On Thu, Dec 10, 2009 at 2:44 PM, Andrew J. Leer <leeand00_at_[hidden]>wrote:
> Right. I added it using the selected answer here:
>
>
> http://stackoverflow.com/questions/212492/how-do-you-add-external-libraries-for-compilation-in-vc
>
> However...I wasn't entirely sure if what I was doing was the
> autolinking that you spoke of, and that sir it what I wanted to ask
> you about.
>
> Thanks again Steve,
> Andrew J. Leer
>
> On Wed, Dec 9, 2009 at 5:57 PM, Steven Watanabe <watanabesj_at_[hidden]>
> wrote:
> > AMDG
> >
> > Andrew J. Leer wrote:
> >>
> >> Eh,
> >>
> >> What's auto linking?
> >>
> >
> > Notice your original error:
> >
> > 1>Linking...
> > 1>LINK : fatal error LNK1104: cannot open file
> > 'libboost_unit_test_framework-vc80-mt-gd-1_40.lib'
> >
> >
> > The Boost.Test library has already told the compiler that it needs
> > this library. You just need to add the directory containing it to
> > the linker's search path.
> >
> > In Christ,
> > Steven Watanabe
> >
> > _______________________________________________
> > Boost-users mailing list
> > Boost-users_at_[hidden]
> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
> >
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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