问题
I come here to ask for a fix to a situation that has been frustrating me. A lot.
First of all, I'm on Windows, I use MinGW as a compiler (C++).
I've been having some problems with getting a program to work with the use of cpp-netlib and SSL (trying to POST to a https site). I believe everything is in order except this one error that keeps evading me.
C:\boost_1_50_0\boost_1_50_0\stage\lib\libboost_thread-mgw46-mt-1_50.a(thread.o):thread.cpp|| undefined reference to 'boost::chrono::system_clock::now()'
I'm sure that I've linked to chrono, as well as all the .a libs in BOOST_ROOT/stage/lib
. I've tried re-ordering so chrono is linked before thread. Nothing helped.
I've tried definining the BOOST_CHRONO_INLINED
in my IDE settings and multiple conf.hpp
s to make it header only, which didn't help.
I'm pretty sure this is a newbie question and I hope that someone can give me a quick fix. I've written this in a rush because I have to be somewhere but if you need more info please say so and I can write it more carefully when I get home. Thanks!
回答1:
I've tried re-ordering so chrono is linked before thread.
That's wrong. Boost.Thread depends on chrono, so chrono needs to be linked after thread, so the linker knows which symbols are needed and can find which library defines them and link to it.
来源:https://stackoverflow.com/questions/11575660/undefined-reference-to-boostchronosystem-clocknow-boost-and-cpp-net