使用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,重新编译链接即可。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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
如果有收获,可以请我喝杯咖啡!