0

How can i compile a C++ code including Boost with Mingw-64/MSYS2?

I already installed this package: https://packages.msys2.org/package/mingw-w64-x86_64-boost

but it doesn't seem to work. I get this error:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\B\AppData\Local\Temp\ccCD6IYB.o:benchmark.cpp:(.text$_ZNK5boost9iostreams11mapped_file4sizeEv[_ZNK5boost9iostreams11mapped_file4sizeEv]+0x18): undefined reference to boost::iostreams::mapped_file_source::size() const' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\B\AppData\Local\Temp\ccCD6IYB.o:benchmark.cpp:(.text$_ZNK5boost9iostreams11mapped_file10const_dataEv[_ZNK5boost9iostreams11mapped_file10const_dataEv]+0x18): undefined reference to boost::iostreams::mapped_file_source::data() const' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\B\AppData\Local\Temp\ccCD6IYB.o:benchmark.cpp:(.text$_ZN5boost9iostreams11mapped_fileC1IPcEERKT_NS0_16mapped_file_base7mapmodeEyx[_ZN5boost9iostreams11mapped_fileC1IPcEERKT_NS0_16mapped_file_base7mapmodeEyx]+0x27): undefined reference to boost::iostreams::mapped_file_source::mapped_file_source()' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\B\AppData\Local\Temp\ccCD6IYB.o:benchmark.cpp:(.text$_ZN5boost9iostreams11mapped_file4openINS0_6detail4pathEEEvRKNS0_24basic_mapped_file_paramsIT_EE[_ZN5boost9iostreams11mapped_file4openINS0_6detail4pathEEEvRKNS0_24basic_mapped_file_paramsIT_EE]+0x20): undefined reference to boost::iostreams::mapped_file_source::open_impl(boost::iostreams::basic_mapped_file_paramsboost::iostreams::detail::path const&)' collect2.exe: error: ld returned 1 exit status

I tried to run this code: https://stackoverflow.com/a/26737146/13566184

Rasule
  • 19
  • 1
  • 6

0 Answers0