After testing the Boost.log on W10 with Visual Studio 2019, I am trying to have the same application (writes a simple log file) running in ubuntu using the Windows Subsystem for Linux.
So, I created a new project with the same source files, configured it to build on WSL using GCC, and indicated to the Linker the boost libraries to look for on WSL.
At first, I was getting a lot of linking errors such as "undefined reference to boost::log::v2s_mt_posix..." which disappeared after adding
#define BOOST_LOG_DYN_LINK 1
as suggested here: linker error while linking boost log tutorial (undefined references)
With this I was able to start debugging with VS but eventually I get a "segmentation fault" when calling logging::add_common_attributes()
in this function
void LOG_InitLogging()
{
logging::register_simple_formatter_factory<logging::trivial::severity_level, char>( "Severity" );
logging::add_file_log(
keywords::file_name = "s.log", //output file
keywords::format = "[%TimeStamp%] [%LineID%] [%ThreadID%] [%ProcessID%] [%Severity%] ",
keywords::auto_flush = true
);
logging::add_common_attributes();
}
I am not very familiar with linux or linking against libraries so some guidance would be greatly appreciated.
Thank you!