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)
Did you mean Boost 1.55.0? Yes, you're right, that was an error when changing the version.
<snip>
This code works right, but when I call make, I get the following errors:
<snip> C:/cppLib/boost_1_55_0/boost/log/detail/snprintf.hpp:45:9: Fehler: ╗::swprintf½ wurde nicht deklariert <snip>
The problem is swprintf. I'm guessing that MinGW doesn't support it. You'll probably need -DBOOST_LOG_WITHOUT_WCHAR_T. I tried to change ADD_DEFINITIONS to ADD_DEFINITIONS("-std=c++0x -DBOOST_LOG_WITHOUT_WCHAR_T"). This changes the errors to:
If I don't use ADD_DEFINITIONS("-std=c++0x"), I got the following errors:
That's odd. Is Boost.Log somehow being compiled with -std=c++0x? It shouldn't be unless you specified it. Not as I know. Trying to recompile boost leads to the following output: http://nopaste.info/446db7594c.html Has it maybe something to do with
CMakeFiles\Hasselbrack.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x124): undefined reference to `boost::log::v2s_mt_nt5::core::get()' CMakeFiles\Hasselbrack.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x13b): undefined reference to `boost::log::v2s_mt_nt5::core::set_filter(boost::log ::v2s_mt_nt5::filter const&)' CMakeFiles\Hasselbrack.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x1bf): undefined reference to `boost::log::v2s_mt_nt5::trivial::logger::get()' CMakeFiles\Hasselbrack.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x1df): undefined reference to `boost::log::v2s_mt_nt5::trivial::logger::get()' 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 address 0x138 in s 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 make[2]: *** [Hasselbrack.exe] Fehler 1 again. But the library is again found correctly in C:/cppLib/boost_1_55_0/stage/lib/libboost_log-mgw47-mt-1_55.dll (And is still correkt in the CMakeCache.txt in Boost_LOG_LIBRARY_RELEASE:FILEPATH=). Is the adding to ADD_DEFINITIONS right, or should I add it somewhere else? At least, it changed the error... the errors? The errors do not realy seem to be related to the log-library.
CMakeFiles\Hasselbrack.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x12c): undefined reference to `boost::log::v2s_mt_nt5::core::get()' <snip>
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
But nevertheless, boost is found and I can't figure out CMake seems to be unable to link it. The output of $(Boost_LIBRARIES) from CMake also seems correct: C:/cppLib/boost_1_55_0/stage/lib/libboost_log-mgw47-mt-1_55.dll . So I got no clue anymore what I could try.
Has anybody an hint how to solve this?
In Christ, Steven Watanabe
Thanks for the advice! Best Regards, DaGeRe