Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with linking files using boost::log with CMake Buildfile
From: David Georg Reichelt (davidgeorg_reichelt_at_[hidden])
Date: 2013-12-07 14:40:59


Am 07.12.2013 17:15, schrieb Steven Watanabe:
> AMDG
>
> On 12/07/2013 04:15 AM, David Georg Reichelt wrote:
>> Am 06.12.2013 16:59, schrieb Steven Watanabe:
>>> AMDG
>>>> <snip>
>>>>
>>>> ADD_DEFINITIONS("-std=c++0x")
>>>> SET(BOOST_ROOT "C:/cppLib/boost_1_55_0/")
>>>> link_libraries (${Boost_LIBRARIES})
>>>>
>>>> find_package( Boost 1.54.0 COMPONENTS log)
>>>>
> Wait a minute. Shouldn't link_libraries
> come /after/ find_package? Does the link
> command line show that you are linking
> to boost_log?
Thanks again for the advice! Yes, in the first place it was like this,
but after Andy told me that it should be in the if-block it is moved
after find_package. The full code now is here:
http://nopaste.info/9e73e7d3ac.html

But after that, I googled if there is any hint what I could be doing
wrong linking boost log. I found the following thread:
http://stackoverflow.com/questions/16540171/boost-log-gcc-4-4-and-cmake
It basiacally says that one has to add multiple libraries to get boost
log running and that one has to get them in a certain order. After
addding them (so now find_package uses find_package( Boost 1.55.0
COMPONENTS system thread filesystem date_time log log_setup REQUIRED)
and the code like in http://nopaste.info/65b3273ade.html) I got the errors:

CMakeFiles\Hasselbrack.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x285):
undefined reference to `std::ios_base::Init::~Init()'
CMakeFiles\Hasselbrack.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x2a6):
undefined reference to `std::ios_base::Init::Init()'
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe:
CMakeFiles\Hasselbrack.dir/objects.a(main.cpp.obj): bad reloc addr
ection `.rdata'
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe:
final link failed: Invalid operation
collect2.exe: Fehler: ld gab 1 als Ende-Status zurück

So something still does not work with the linker... Do you have any idea
what?
>
> In Christ,
> Steven Watanabe
Best Regards,
DaGeRe


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