undefined reference to `boost::chrono::system_clock::now()' - Boost, and cpp-netlib
Asked Answered
R

1

7

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!

Rheumatoid answered 20/7, 2012 at 8:30 Comment(0)
H
9

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.

Hematite answered 20/7, 2012 at 8:37 Comment(2)
Thanks for the answer. I will have a go at trying this when I get home, but I do recall, before reordering, that chrono was linked after thread. I'll see.Rheumatoid
You should post the full linker command then, otherwise everyone's just guessing what you might have done or not doneHematite

© 2022 - 2024 — McMap. All rights reserved.