Boost logo

Boost Users :

Subject: Re: [Boost-users] Fwd: Getting ASIO application to link (undefined reference to `boost::system::generic_category()) (SOLVED)
From: Ulf Samuelsson (boost-user_at_[hidden])
Date: 2013-09-18 02:40:27


On 2013-09-18 08:32, Slava wrote:
> On Tue, 17 Sep 2013 19:20:54 +0200, Ulf Samuelsson
> <boost-user_at_[hidden]> wrote:
>
>> Solved!
>> The Libraries need to be at the end during the link phase.
>>
>> $ g++ -c -I/usr/include -Iinclude -std=c++0x -o udp_echo_client.o
>> udp_echo_client.cpp
>> $ g++ -o udp_echo_client udp_echo_client.o -L/usr/lib -lboost_filesystem
>> -lboost_system -lpthread
>>
>> works
>>
>> BR
>> Ulf
>>
>
> ... what means that the linker uses static libraries (.a).
> Use -t linker flag (-Wl,-t to gcc) to debug which libraries linker
> finds and which it takes.
> // The *.so are in -dev packages in some distributions. Maybe you need
> boost*dev package(s) installed in ubuntu?
>
No, the solution is simple. The -l<library> must be AFTER the reference
to the object files.

FAIL: g++ -lboost_system myfile.o
OK: g++ myfile.o -lboost_system

Maybe there is a good reason for this.
BR
Ulf

> Regards, Slava
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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