Unresolved external symbol boost::chrono::system_c

2019-05-01 21:33发布

问题:

google has been unkind...

I recently pulled down boost 1.50, and am trying to build my project using it. It's a large project, using several boost features (threads, signals, pointer classes, spirit, etc.). Some specifics:
- MSVC 9.0 (2008)
- Static linking boost

I'm getting an error linking every resulting exe, but with chrono, which I'm not directly linking. The error is:

libboost_thread-vc90-mt-sgd-1_50.lib(thread.obj) : error LNK2019: unresolved external symbol "public: static class boost::chrono::time_point<class boost::chrono::system_clock,class boost::chrono::duration<__int64,class boost::ratio<1,10000000> > > __cdecl boost::chrono::system_clock::now(void)" (?now@system_clock@chrono@boost@@SA?AV?$time_point@Vsystem_clock@chrono@boost@@V?$duration@_JV?$ratio@$00$0JIJGIA@@boost@@@23@@23@XZ) referenced in function "public: bool __thiscall boost::thread::try_join_until(class boost::chrono::time_point<class boost::chrono::system_clock,class boost::chrono::duration<__int64,class boost::ratio<1,1000000000> > > const &)" (?try_join_until@thread@boost@@QAE_NABV?$time_point@Vsystem_clock@chrono@boost@@V?$duration@_JV?$ratio@$00$0DLJKMKAA@@boost@@@23@@chrono@2@@Z)

I saw this question, but I'm not directly controlling the order of linking (rather using the auto-link capabilities). If there's a specific lib I'm missing, I can manually link it; sub-optimal, but possible. However, I have no idea what's missing. It appears (to my semi-educated view) that the symbol is externed in the chrono lib, and not in the system lib.

Any help?

回答1:

Have a look at the documentation. It specifies that you have to link to chrono and system to use thread unless you give some specific macros to disable their use (and lose their functionality).