且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

未定义的引用`的boost ::时辰:: SYSTEM_CLOCK ::现在()“ - 升压和CPP-NETLIB

更新时间:2023-10-23 14:33:28


  

我试过重新排序,以便在计时线程之前联系。


块引用>

这是错误的。 Boost.Thread要看时辰,所以计时需要链接的之后的线程,因此链接器知道需要哪些符号,可以找到该库他们和链路来定义它。

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.hpps 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!

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.