|
Boost Users : |
From: Darren Mason (darrenmason_at_[hidden])
Date: 2008-05-26 01:54:40
Hi all.
I've built a static library that references boost threads, conditions and
ptime. All the libraries were build with the following command "bjam
--layout=system link=static release debug", then renamed to something more
generic eg. boost_thread-mt.lib for the multi-threaded release version of
the thread library. Now I know I did get the static libraries and not the
DLL bridges because it was originally named libboost_thread-mt.lib.
Actually I also used the --buildid command to add something other than
-1_35, but I don't think that really matters. Anyway, the Win32 version of
my project is built using VS2008, so I have a top level include file that
defines BOOST_ALL_NO_LIB to prevent auto-linking. I then explicitly link
the libraries that I need and build my project library. I assume it's
actually linking everything in successfully since the output lib is vastly
larger when I link the libs than when I don't.
Now the real problem comes when I try to link to this library in my test
application. I've switched up whether it is the lib or the application that
defines BOOST_ALL_NO_LIB, and who actually links to the libraries etc. I've
also made sure that they're all using the same run-time build settings eg.
/MTd for both my lib and app, which would link to the -mt-gd version of the
boost libraries. No matter what I do, I get a bunch of warnings about using
locally defined symbols (changing which one links the libraries just changes
whether the warning originates from my lib or boost's) and a few unresolved
externals. They look something like this:
Common.lib(thread.obj) : warning LNK4217: locally defined symbol
??0id_at_locale@std@@QAE_at_I@Z (public: __thiscall std::locale::id::id(unsigned
int)) imported in function "void __cdecl `dynamic initializer for 'public:
static class std::locale::id boost::date_time::date_facet<class
boost::gregorian::date,char,class std::ostreambuf_iterator<char,struct
std::char_traits<char> > >::id''(void)" (??__E?id@?$date_facet_at_Vdate
@gregorian_at_boost@@DV?$ostreambuf_iterator_at_DU?$char_traits_at_D@std@@@std@
@@date_time_at_boost@@2V0locale_at_std@@A@@YAXXZ)
Common.lib(thread.obj) : error LNK2019: unresolved external symbol
__imp___beginthreadex referenced in function "private: void __thiscall
boost::thread::start_thread(void)" (?start_thread_at_thread@boost@@AAEXXZ)
If I'm not mistaken, LNK4217 means that the linker believes the symbol is
local, but it's using a different calling convention, almost like it thinks
it's importing from a DLL. I could suppress those by compiling against the
Common Language Runtime, but somehow I think that I'm seeing these might be
the root of my problem. Any thoughts?
All I really want to be able to do is have an external app link to my
libraries without having to also link to boost. I can only assume that I'm
either not linking them into my library properly or that I'm not using the
right boost defines. It's probably something really simple that I'm
missing, but it's been driving me crazy and I'm just not getting anywhere.
Any help would be appreciated.
Thanks in advance,
Darren Mason
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