使用Dlib编程出现X11相关错误

文章作者:Tyan
博客:noahsnail.com  |  CSDN  |  简书

在使用dlib库编写GUI程序时,链接时出现下面的错误,解决方案为:1. 命令行链接时添加-L/opt/X11/lib -lX11即可;2. IDE下编写C++程序,需要在Library search path(-L)中添加/opt/X11/lib,在Libraries(-l)中添加X11,重新编译链接即可。

Undefined symbols for architecture x86_64:
  "_XAllocColor", referenced from:
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XAllocSizeHints", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::base_window(bool, bool) in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::set_size(int, int) in libdlib.a(gui_core_kernel_2.o)
  "_XChangeProperty", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
  "_XCheckIfEvent", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
  "_XClearArea", referenced from:
      dlib::base_window::invalidate_rectangle(dlib::rectangle const&) in libdlib.a(gui_core_kernel_2.o)
  "_XCloseDisplay", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::~event_handler_thread() in libdlib.a(gui_core_kernel_2.o)
      nativefont::font_renderer::font_renderer::vals_internal::~vals_internal() in libdlib.a(fonts.o)
  "_XCloseIM", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::~event_handler_thread() in libdlib.a(gui_core_kernel_2.o)
  "_XConvertSelection", referenced from:
      dlib::get_from_clipboard(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&) in libdlib.a(gui_core_kernel_2.o)
  "_XCreateFontSet", referenced from:
      dlib::base_window::base_window(bool, bool) in libdlib.a(gui_core_kernel_2.o)
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XCreateGC", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XCreateIC", referenced from:
      dlib::base_window::base_window(bool, bool) in libdlib.a(gui_core_kernel_2.o)
  "_XCreatePixmap", referenced from:
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XCreateWindow", referenced from:
      dlib::base_window::base_window(bool, bool) in libdlib.a(gui_core_kernel_2.o)
      dlib::gui_core_kernel_2_globals::event_handler_thread::thread() in libdlib.a(gui_core_kernel_2.o)
  "_XDefaultDepth", referenced from:
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XDestroyIC", referenced from:
      dlib::base_window::~base_window() in libdlib.a(gui_core_kernel_2.o)
  "_XDestroyWindow", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::close_window() in libdlib.a(gui_core_kernel_2.o)
  "_XExtentsOfFontSet", referenced from:
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XFillRectangle", referenced from:
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XFilterEvent", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
  "_XFlush", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::set_title(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&) in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::show() in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::hide() in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::set_size(int, int) in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::set_pos(long, long) in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::invalidate_rectangle(dlib::rectangle const&) in libdlib.a(gui_core_kernel_2.o)
      ...
  "_XFree", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
      dlib::get_from_clipboard(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&) in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::base_window(bool, bool) in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::set_title(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&) in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::set_size(int, int) in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::set_im_pos(long, long) in libdlib.a(gui_core_kernel_2.o)
  "_XFreeFontSet", referenced from:
      dlib::base_window::~base_window() in libdlib.a(gui_core_kernel_2.o)
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
      nativefont::font_renderer::font_renderer::vals_internal::~vals_internal() in libdlib.a(fonts.o)
  "_XFreeGC", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
      nativefont::font_renderer::font_renderer::vals_internal::~vals_internal() in libdlib.a(fonts.o)
  "_XFreeModifiermap", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::init_keyboard_mod_masks() in libdlib.a(gui_core_kernel_2.o)
  "_XFreePixmap", referenced from:
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
      nativefont::font_renderer::font_renderer::vals_internal::~vals_internal() in libdlib.a(fonts.o)
  "_XFreeStringList", referenced from:
      dlib::base_window::base_window(bool, bool) in libdlib.a(gui_core_kernel_2.o)
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XGetICValues", referenced from:
      dlib::base_window::base_window(bool, bool) in libdlib.a(gui_core_kernel_2.o)
  "_XGetImage", referenced from:
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XGetModifierMapping", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::init_keyboard_mod_masks() in libdlib.a(gui_core_kernel_2.o)
  "_XGetSelectionOwner", referenced from:
      dlib::get_from_clipboard(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&) in libdlib.a(gui_core_kernel_2.o)
  "_XGetWindowProperty", referenced from:
      dlib::get_from_clipboard(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&) in libdlib.a(gui_core_kernel_2.o)
  "_XInitImage", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
  "_XInitThreads", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::thread() in libdlib.a(gui_core_kernel_2.o)
  "_XInternAtom", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
      dlib::get_from_clipboard(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&) in libdlib.a(gui_core_kernel_2.o)
      dlib::gui_core_kernel_2_globals::event_handler_thread::thread() in libdlib.a(gui_core_kernel_2.o)
  "_XLookupString", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
  "_XMapRaised", referenced from:
      dlib::base_window::show() in libdlib.a(gui_core_kernel_2.o)
  "_XMoveWindow", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::set_pos(long, long) in libdlib.a(gui_core_kernel_2.o)
  "_XNextEvent", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
  "_XOpenDisplay", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::thread() in libdlib.a(gui_core_kernel_2.o)
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XPeekIfEvent", referenced from:
      dlib::get_from_clipboard(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&) in libdlib.a(gui_core_kernel_2.o)
  "_XPending", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
  "_XPutBackEvent", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::~event_handler_thread() in libdlib.a(gui_core_kernel_2.o)
  "_XPutImage", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
  "_XQueryColor", referenced from:
      nativefont::font_renderer::font_renderer::vals_internal::color2rgb(unsigned long, _XDisplay*, unsigned long&) in libdlib.a(fonts.o)
  "_XResizeWindow", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::set_size(int, int) in libdlib.a(gui_core_kernel_2.o)
  "_XScreenNumberOfScreen", referenced from:
      dlib::base_window::get_display_size(unsigned long&, unsigned long&) const in libdlib.a(gui_core_kernel_2.o)
  "_XSelectInput", referenced from:
      dlib::base_window::base_window(bool, bool) in libdlib.a(gui_core_kernel_2.o)
  "_XSendEvent", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
      dlib::gui_core_kernel_2_globals::event_handler_thread::~event_handler_thread() in libdlib.a(gui_core_kernel_2.o)
  "_XSetBackground", referenced from:
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XSetForeground", referenced from:
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XSetICValues", referenced from:
      dlib::base_window::set_im_pos(long, long) in libdlib.a(gui_core_kernel_2.o)
  "_XSetNormalHints", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::base_window(bool, bool) in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::set_size(int, int) in libdlib.a(gui_core_kernel_2.o)
  "_XSetSelectionOwner", referenced from:
      dlib::put_on_clipboard(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&) in libdlib.a(gui_core_kernel_2.o)
  "_XSetWMName", referenced from:
      dlib::base_window::set_title(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&) in libdlib.a(gui_core_kernel_2.o)
  "_XSetWMProtocols", referenced from:
      dlib::base_window::base_window(bool, bool) in libdlib.a(gui_core_kernel_2.o)
  "_XTranslateCoordinates", referenced from:
      dlib::base_window::get_pos(long&, long&) in libdlib.a(gui_core_kernel_2.o)
  "_XUnmapWindow", referenced from:
      dlib::base_window::hide() in libdlib.a(gui_core_kernel_2.o)
  "_XVaCreateNestedList", referenced from:
      dlib::base_window::base_window(bool, bool) in libdlib.a(gui_core_kernel_2.o)
      dlib::base_window::set_im_pos(long, long) in libdlib.a(gui_core_kernel_2.o)
  "_XkbKeycodeToKeysym", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::init_keyboard_mod_masks() in libdlib.a(gui_core_kernel_2.o)
  "_XwcDrawString", referenced from:
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XwcFreeStringList", referenced from:
      dlib::get_from_clipboard(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&) in libdlib.a(gui_core_kernel_2.o)
  "_XwcLookupString", referenced from:
      dlib::gui_core_kernel_2_globals::event_handler_thread::event_handler() in libdlib.a(gui_core_kernel_2.o)
  "_XwcTextExtents", referenced from:
      void nativefont::font_renderer::font_renderer::vals_internal::create<unsigned int>(unsigned int*, int, bool, bool, bool, nativefont::font_renderer::font_renderer::rgb_type, nativefont::font_renderer::font_renderer::rgb_type) in libdlib.a(fonts.o)
  "_XwcTextListToTextProperty", referenced from:
      dlib::base_window::set_title(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&) in libdlib.a(gui_core_kernel_2.o)
  "_XwcTextPropertyToTextList", referenced from:
      dlib::get_from_clipboard(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&) in libdlib.a(gui_core_kernel_2.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [3dCloud] Error 1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值