From: bwlee (bwlee.sky_at_[hidden])
Date: 2006-03-29 08:54:37
Really useful message, not drawn in the sea!
I have a similiar question, maybe just because I set something wrong, now I
compiling some code in vc++ 2005 express, I found a very strange linking
problem, it failed to find the class member unless I put those function
bodies into the header file(just copy & paste or include .cpp file at the
end of the header file).
It seems really stupid, and I wonder why it happens!
I am not sure if it is my own mistake because it is my first time using the
vc++ 2005 express.
I need to use boost and some other odbc libraries for windows applications,
any other solutions?
Thanks in advance!
On 3/29/06, Ulrich Eckhardt <doomster_at_[hidden]> wrote:
> I think it was with boost 1.30 where we started using the threads library
> at that time build support was not yet at the stage where we could really
> it the way we wanted it to so we mostly invented our own. The first thing
> did was to copy the required sourcefiles into the project where we needed
> them, i.e. the most primitive form of static linking. Later on, we
> that with #including the sourcefiles (<lib/thread/src/...>) into a single
> file - the same thing only done in a way that we could switch to the next
> Boost version without changing our code. Well, at least we thought so,
> files moved between Boost versions inside the source folder, another
> is that e.g. timeconv.inl provides things in an anonymous namespace and
> included by more than one sourcefile but doesn't have include guards.
> Anyhow, what I wonder is whether this is not a way that should be
> actively. In our case, it significantly reduced the adoption barrier for
> threading lib, it also makes bjam use unnecessary (which I, even though I
> quite some things with it already, still find unwieldy and don't
> understand), it avoids the problem of different compiler ABIs due to
> different compiler versions or settings and it reduces the additional
> required size of the final executable (example-prog with above static
> linking weighs 52kB, the thread lib alone would have been 92kB already
> I personally would be interested in documenting how to use Boost libs this
> and also make it an officially supported way to do so.
> : The example program below has been compiled with GCC using Boost 1.33
> the only patch necessary was to add include guards to timeconv.inl.
> #include <iostream>
> #include <ostream>
> #include <boost/thread/thread.hpp>
> #include <boost/thread/xtime.hpp>
> // for 'static' linking
> #include <libs/thread/src/thread.cpp>
> #include <libs/thread/src/xtime.cpp>
> #include <libs/thread/src/mutex.cpp>
> #include <libs/thread/src/exceptions.cpp>
> #include <libs/thread/src/condition.cpp>
> void thread()
> std::cout << "thread(): entering\n";
> boost::xtime tm;
> boost::xtime_get(&tm, boost::TIME_UTC);
> tm.sec += 2;
> std::cout << "thread(): leaving\n";
> int main()
> std::cout << "main(): creating thread\n";
> boost::thread th(&thread);
> std::cout << "main(): waiting\n";
> std::cout << "main(): done\n";
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk