【发布时间】:2021-07-28 12:36:02
【问题描述】:
我用 lib-boost 编写了一个简单的代码来加载一个 CSV 文件。编译后出现以下错误:
Undefined symbols for architecture arm64:
"boost::iostreams::mapped_file_source::init()", referenced from:
boost::iostreams::mapped_file_source::mapped_file_source<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, long) in class_map.cpp.o
"boost::iostreams::mapped_file_source::open_impl(boost::iostreams::basic_mapped_file_params<boost::iostreams::detail::path> const&)", referenced from:
void boost::iostreams::mapped_file_source::open<boost::iostreams::detail::path>(boost::iostreams::basic_mapped_file_params<boost::iostreams::detail::path> const&) in class_map.cpp.o
"boost::iostreams::mapped_file_source::end() const", referenced from:
MyMap::loadCSV(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in class_map.cpp.o
"boost::iostreams::mapped_file_source::begin() const", referenced from:
MyMap::loadCSV(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in class_map.cpp.o
ld: symbol(s) not found for architecture arm64
我使用自制软件安装了 boost,它包含在 cmakelist 中。
Found Boost: /opt/homebrew/lib/cmake/Boost-1.75.0/BoostConfig.cmake (found version "1.75.0") found components: system filesystem
【问题讨论】: