使用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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,378评论 6 481
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,356评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 152,702评论 0 342
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,259评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,263评论 5 371
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,036评论 1 285
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,349评论 3 400
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,979评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,469评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,938评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,059评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,703评论 4 323
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,257评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,262评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,485评论 1 262
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,501评论 2 354
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,792评论 2 345

推荐阅读更多精彩内容