如何解决构建 Dlib 代码时的编译错误



我试图使用MinGW和Netbeans运行示例Dlib代码。但是我遇到了编译错误。

遵循的步骤:

1.从Dlib网站下载Dlib软件包。

2.在 c++ 编译器设置中包含根文件夹 (Dlib),并在编译器附加标志中设置 -std=c++11。

3.从 Dlib 文件夹示例中复制示例。

4.编译。

编译代码时出现波纹管错误。给我执行 Dlib 示例代码的简单步骤(例如 Dlib 示例中face_detection_ex代码)

build/Debug/MinGW-Windows/main.o: In function `Z12loadIbugDataN5boost10filesystem4pathE':
D:NetBeansProjectsSDM/main.cpp:124: undefined reference to `boost::filesystem::path::extension() const'
D:NetBeansProjectsSDM/main.cpp:133: undefined reference to `boost::filesystem::path::replace_extension(boost::filesystem::path const&)'
build/Debug/MinGW-Windows/main.o: In function `main':
D:NetBeansProjectsSDM/main.cpp:355: undefined reference to `boost::program_options::options_description::m_default_line_length'
D:NetBeansProjectsSDM/main.cpp:355: undefined reference to `boost::program_options::options_description::m_default_line_length'
D:NetBeansProjectsSDM/main.cpp:355: undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
D:NetBeansProjectsSDM/main.cpp:358: undefined reference to `boost::program_options::options_description::add_options()'
D:NetBeansProjectsSDM/main.cpp:358: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, char const*)'
D:NetBeansProjectsSDM/main.cpp:360: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*)'
D:NetBeansProjectsSDM/main.cpp:362: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*)'
D:NetBeansProjectsSDM/main.cpp:365: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*)'
D:NetBeansProjectsSDM/main.cpp:366: undefined reference to `boost::program_options::variables_map::variables_map()'
D:NetBeansProjectsSDM/main.cpp:367: undefined reference to `boost::program_options::store(boost::program_options::basic_parsed_options<char> const&, boost::program_options::variables_map&, bool)'
D:NetBeansProjectsSDM/main.cpp:370: undefined reference to `boost::program_options::operator<<(std::ostream&, boost::program_options::options_description const&)'
D:NetBeansProjectsSDM/main.cpp:373: undefined reference to `boost::program_options::notify(boost::program_options::variables_map&)'

如果你在 Linux 中,你需要将 libvl.so 添加到链接器设置中。在 64 位系统中,您可以在/vlfeat/bin/glnxa64/中找到此文件。

最新更新