huahsin68 - 2017-09-02

I am using Boost 1.61 on Windows 10 with Qt 5.7.0 MinGW 32 bit compiler. I have been using the Boost for a while until I added Boost Log recently into my project, I got an undefined error on boost::filesystem whenever I have the following piece of code, the error will gone when I remove it:

boost::log::add_file_log
            (
                keyword::file_name = "sample.log",
                keyword::rotation_size = 10 * 1024 * 1024,
                keyword::time_based_rotation = boost::log::sinks::file::rotation_at_time_point(0,0,0),
                keyword::format = "[%TimeStamp%]: %Message%"
            );

I have also tested the above code on Linux machine and found no error on it. I'm not sure whether this only happened on Windows machine? Attached below the stacktrace for your reference, hope to find any clue on this matter.

D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `make_absolute':
d:\tool\boost_1_61_0/libs/log/src/text_file_backend.cpp:597: undefined reference to `boost::filesystem::absolute(boost::filesystem::path const&, boost::filesystem::path const&)'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `store_file':
d:\tool\boost_1_61_0/libs/log/src/text_file_backend.cpp:695: undefined reference to `boost::filesystem::path::parent_path() const'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `scan_for_files':
d:\tool\boost_1_61_0/libs/log/src/text_file_backend.cpp:776: undefined reference to `boost::filesystem::path::parent_path() const'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost3log10v2s_mt_nt55sinks17text_file_backend7consumeERKNS1_11record_viewERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE':
d:\tool\boost_1_61_0/libs/log/src/text_file_backend.cpp:1218: undefined reference to `boost::filesystem::path::parent_path() const'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost3log10v2s_mt_nt55sinks17text_file_backend30set_file_name_pattern_internalERKNS_10filesystem4pathE':
d:\tool\boost_1_61_0/libs/log/src/text_file_backend.cpp:1265: undefined reference to `boost::filesystem::path::parent_path() const'
d:\tool\boost_1_61_0/libs/log/src/text_file_backend.cpp:1265: undefined reference to `boost::filesystem::absolute(boost::filesystem::path const&, boost::filesystem::path const&)'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZNK5boost10filesystem4path15has_parent_pathEv':
d:\tool\boost_1_61_0/./boost/filesystem/path.hpp:516: undefined reference to `boost::filesystem::path::parent_path() const'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost10filesystemdvERKNS0_4pathES3_':
d:\tool\boost_1_61_0/./boost/filesystem/path.hpp:789: undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost10filesystem12current_pathEv':
d:\tool\boost_1_61_0/./boost/filesystem/operations.hpp:596: undefined reference to `boost::filesystem::detail::current_path(boost::system::error_code*)'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost10filesystem10equivalentERKNS0_4pathES3_':
d:\tool\boost_1_61_0/./boost/filesystem/operations.hpp:608: undefined reference to `boost::filesystem::detail::equivalent(boost::filesystem::path const&, boost::filesystem::path const&, boost::system::error_code*)'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost10filesystem9file_sizeERKNS0_4pathE':
d:\tool\boost_1_61_0/./boost/filesystem/operations.hpp:614: undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost10filesystem9file_sizeERKNS0_4pathERNS_6system10error_codeE':
d:\tool\boost_1_61_0/./boost/filesystem/operations.hpp:618: undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost10filesystem15last_write_timeERKNS0_4pathE':
d:\tool\boost_1_61_0/./boost/filesystem/operations.hpp:637: undefined reference to `boost::filesystem::detail::last_write_time(boost::filesystem::path const&, boost::system::error_code*)'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost10filesystem6renameERKNS0_4pathES3_':
d:\tool\boost_1_61_0/./boost/filesystem/operations.hpp:677: undefined reference to `boost::filesystem::detail::rename(boost::filesystem::path const&, boost::filesystem::path const&, boost::system::error_code*)'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost10filesystem5spaceERKNS0_4pathE':
d:\tool\boost_1_61_0/./boost/filesystem/operations.hpp:698: undefined reference to `boost::filesystem::detail::space(boost::filesystem::path const&, boost::system::error_code*)'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost10filesystem15system_completeERKNS0_4pathE':
d:\tool\boost_1_61_0/./boost/filesystem/operations.hpp:710: undefined reference to `boost::filesystem::detail::system_complete(boost::filesystem::path const&, boost::system::error_code*)'
D:/tool/boost_1_61_0/stage/lib/libboost_log-mgw53-mt-d-1_61.a(text_file_backend.o): In function `ZN5boost10filesystem4pathaSINS0_15directory_entryEEENS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIT_E4typeEEERS1_E4typeERKS8_':
d:\tool\boost_1_61_0/./boost/filesystem/path.hpp:202: undefined reference to `boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
collect2.exe: error: ld returned 1 exit status