Closed Hugothms closed 4 years ago
When i try to compile my project with the libary I get this error message:
./minilibx/libmlx.a(mlx_init.o): In function mlx_int_deal_shm': mlx_init.c:(.text+0x2c): undefined reference toXShmQueryVersion' mlx_init.c:(.text+0x11c): undefined reference to XShmPixmapFormat' ./minilibx/libmlx.a(mlx_init.o): In functionmlx_init': mlx_init.c:(.text+0x14f): undefined reference to XOpenDisplay' mlx_init.c:(.text+0x2de): undefined reference toXCreateColormap' ./minilibx/libmlx.a(mlx_new_window.o): In function mlx_new_window': mlx_new_window.c:(.text+0x92): undefined reference toXCreateWindow' mlx_new_window.c:(.text+0xbb): undefined reference to XStoreName' mlx_new_window.c:(.text+0xe6): undefined reference toXCreateGC' mlx_new_window.c:(.text+0x113): undefined reference to XMapRaised' ./minilibx/libmlx.a(mlx_loop.o): In functionmlx_loop': mlx_loop.c:(.text+0x4b): undefined reference to XPending' mlx_loop.c:(.text+0x6a): undefined reference toXNextEvent' ./minilibx/libmlx.a(mlx_int_anti_resize_win.o): In function mlx_int_anti_resize_win': mlx_int_anti_resize_win.c:(.text+0x55): undefined reference toXGetWMNormalHints' mlx_int_anti_resize_win.c:(.text+0x80): undefined reference to XSetWMNormalHints' ./minilibx/libmlx.a(mlx_int_wait_first_expose.o): In functionmlx_int_wait_first_expose': mlx_int_wait_first_expose.c:(.text+0x2e): undefined reference to XWindowEvent' mlx_int_wait_first_expose.c:(.text+0x39): undefined reference toXPutBackEvent' ./minilibx/libmlx.a(mlx_int_get_visual.o): In function mlx_int_get_visual': mlx_int_get_visual.c:(.text+0x61): undefined reference toXGetVisualInfo' ./minilibx/libmlx.a(mlx_new_image.o): In function mlx_int_new_xshm_image': mlx_new_image.c:(.text+0xa7): undefined reference toXShmCreateImage' mlx_new_image.c:(.text+0x142): undefined reference to XSetErrorHandler' mlx_new_image.c:(.text+0x152): undefined reference toXShmAttach' mlx_new_image.c:(.text+0x160): undefined reference to XSync' mlx_new_image.c:(.text+0x174): undefined reference toXSetErrorHandler' mlx_new_image.c:(.text+0x1a0): undefined reference to XCreatePixmap' mlx_new_image.c:(.text+0x1d6): undefined reference toXSetErrorHandler' mlx_new_image.c:(.text+0x214): undefined reference to XFlush' mlx_new_image.c:(.text+0x23d): undefined reference toXShmCreatePixmap' ./minilibx/libmlx.a(mlx_new_image.o): In function mlx_int_new_image': mlx_new_image.c:(.text+0x2c9): undefined reference toXCreateImage' mlx_new_image.c:(.text+0x305): undefined reference to XCreatePixmap' mlx_new_image.c:(.text+0x324): undefined reference toXFlush' ./minilibx/libmlx.a(mlx_new_image.o): In function mlx_new_image': mlx_new_image.c:(.text+0x3fb): undefined reference toXCreateImage' mlx_new_image.c:(.text+0x43a): undefined reference to XCreatePixmap' mlx_new_image.c:(.text+0x460): undefined reference toXFlush' ./minilibx/libmlx.a(mlx_new_image.o): In function mlx_new_image2': mlx_new_image.c:(.text+0x53b): undefined reference toXCreateImage' mlx_new_image.c:(.text+0x57a): undefined reference to XCreatePixmap' mlx_new_image.c:(.text+0x5a0): undefined reference toXFlush' ./minilibx/libmlx.a(mlx_put_image_to_window.o): In function mlx_put_image_to_window': mlx_put_image_to_window.c:(.text+0x33): undefined reference toXSetClipOrigin' mlx_put_image_to_window.c:(.text+0x6c): undefined reference to XCopyArea' mlx_put_image_to_window.c:(.text+0xd5): undefined reference toXPutImage' mlx_put_image_to_window.c:(.text+0x113): undefined reference to XShmPutImage' mlx_put_image_to_window.c:(.text+0xb3): undefined reference toXFlush' ./minilibx/libmlx.a(mlx_clear_window.o): In function mlx_clear_window': mlx_clear_window.c:(.text+0xb): undefined reference toXClearWindow' mlx_clear_window.c:(.text+0x25): undefined reference to XFlush' ./minilibx/libmlx.a(mlx_destroy_window.o): In functionmlx_destroy_window': mlx_destroy_window.c:(.text+0x6a): undefined reference to XDestroyWindow' mlx_destroy_window.c:(.text+0x77): undefined reference toXFreeGC' mlx_destroy_window.c:(.text+0xd1): undefined reference to XFlush' ./minilibx/libmlx.a(mlx_int_param_event.o): In functionmlx_int_param_KeyPress': mlx_int_param_event.c:(.text+0x101): undefined reference to XkbKeycodeToKeysym' ./minilibx/libmlx.a(mlx_int_param_event.o): In functionmlx_int_param_KeyRelease': mlx_int_param_event.c:(.text+0x141): undefined reference to XkbKeycodeToKeysym' ./minilibx/libmlx.a(mlx_int_set_win_event_mask.o): In functionmlx_int_set_win_event_mask': mlx_int_set_win_event_mask.c:(.text+0x2e2): undefined reference to XChangeWindowAttributes' ./minilibx/libmlx.a(mlx_hook.o): In functionmlx_do_key_autorepeatoff': mlx_hook.c:(.text+0x24): undefined reference to XAutoRepeatOff' ./minilibx/libmlx.a(mlx_hook.o): In functionmlx_do_key_autorepeaton': mlx_hook.c:(.text+0x34): undefined reference to XAutoRepeatOn' ./minilibx/libmlx.a(mlx_hook.o): In functionmlx_do_sync': mlx_hook.c:(.text+0x46): undefined reference to `XSync' collect2: error: ld returned 1 exit status
mlx_int_deal_shm': mlx_init.c:(.text+0x2c): undefined reference to
XShmPixmapFormat' ./minilibx/libmlx.a(mlx_init.o): In function
XOpenDisplay' mlx_init.c:(.text+0x2de): undefined reference to
mlx_new_window': mlx_new_window.c:(.text+0x92): undefined reference to
XStoreName' mlx_new_window.c:(.text+0xe6): undefined reference to
XMapRaised' ./minilibx/libmlx.a(mlx_loop.o): In function
XPending' mlx_loop.c:(.text+0x6a): undefined reference to
mlx_int_anti_resize_win': mlx_int_anti_resize_win.c:(.text+0x55): undefined reference to
XSetWMNormalHints' ./minilibx/libmlx.a(mlx_int_wait_first_expose.o): In function
XWindowEvent' mlx_int_wait_first_expose.c:(.text+0x39): undefined reference to
mlx_int_get_visual': mlx_int_get_visual.c:(.text+0x61): undefined reference to
mlx_int_new_xshm_image': mlx_new_image.c:(.text+0xa7): undefined reference to
XSetErrorHandler' mlx_new_image.c:(.text+0x152): undefined reference to
XSync' mlx_new_image.c:(.text+0x174): undefined reference to
XCreatePixmap' mlx_new_image.c:(.text+0x1d6): undefined reference to
XFlush' mlx_new_image.c:(.text+0x23d): undefined reference to
mlx_int_new_image': mlx_new_image.c:(.text+0x2c9): undefined reference to
XCreatePixmap' mlx_new_image.c:(.text+0x324): undefined reference to
mlx_new_image': mlx_new_image.c:(.text+0x3fb): undefined reference to
XCreatePixmap' mlx_new_image.c:(.text+0x460): undefined reference to
mlx_new_image2': mlx_new_image.c:(.text+0x53b): undefined reference to
XCreatePixmap' mlx_new_image.c:(.text+0x5a0): undefined reference to
mlx_put_image_to_window': mlx_put_image_to_window.c:(.text+0x33): undefined reference to
XCopyArea' mlx_put_image_to_window.c:(.text+0xd5): undefined reference to
XShmPutImage' mlx_put_image_to_window.c:(.text+0xb3): undefined reference to
mlx_clear_window': mlx_clear_window.c:(.text+0xb): undefined reference to
XFlush' ./minilibx/libmlx.a(mlx_destroy_window.o): In function
XDestroyWindow' mlx_destroy_window.c:(.text+0x77): undefined reference to
XFlush' ./minilibx/libmlx.a(mlx_int_param_event.o): In function
XkbKeycodeToKeysym' ./minilibx/libmlx.a(mlx_int_param_event.o): In function
XkbKeycodeToKeysym' ./minilibx/libmlx.a(mlx_int_set_win_event_mask.o): In function
XChangeWindowAttributes' ./minilibx/libmlx.a(mlx_hook.o): In function
XAutoRepeatOff' ./minilibx/libmlx.a(mlx_hook.o): In function
XAutoRepeatOn' ./minilibx/libmlx.a(mlx_hook.o): In function
I found the error: it was my mistake I forgot to include the libraries X11 and Xext while compiling.
When i try to compile my project with the libary I get this error message:
./minilibx/libmlx.a(mlx_init.o): In function
mlx_int_deal_shm': mlx_init.c:(.text+0x2c): undefined reference to
XShmQueryVersion' mlx_init.c:(.text+0x11c): undefined reference toXShmPixmapFormat' ./minilibx/libmlx.a(mlx_init.o): In function
mlx_init': mlx_init.c:(.text+0x14f): undefined reference toXOpenDisplay' mlx_init.c:(.text+0x2de): undefined reference to
XCreateColormap' ./minilibx/libmlx.a(mlx_new_window.o): In functionmlx_new_window': mlx_new_window.c:(.text+0x92): undefined reference to
XCreateWindow' mlx_new_window.c:(.text+0xbb): undefined reference toXStoreName' mlx_new_window.c:(.text+0xe6): undefined reference to
XCreateGC' mlx_new_window.c:(.text+0x113): undefined reference toXMapRaised' ./minilibx/libmlx.a(mlx_loop.o): In function
mlx_loop': mlx_loop.c:(.text+0x4b): undefined reference toXPending' mlx_loop.c:(.text+0x6a): undefined reference to
XNextEvent' ./minilibx/libmlx.a(mlx_int_anti_resize_win.o): In functionmlx_int_anti_resize_win': mlx_int_anti_resize_win.c:(.text+0x55): undefined reference to
XGetWMNormalHints' mlx_int_anti_resize_win.c:(.text+0x80): undefined reference toXSetWMNormalHints' ./minilibx/libmlx.a(mlx_int_wait_first_expose.o): In function
mlx_int_wait_first_expose': mlx_int_wait_first_expose.c:(.text+0x2e): undefined reference toXWindowEvent' mlx_int_wait_first_expose.c:(.text+0x39): undefined reference to
XPutBackEvent' ./minilibx/libmlx.a(mlx_int_get_visual.o): In functionmlx_int_get_visual': mlx_int_get_visual.c:(.text+0x61): undefined reference to
XGetVisualInfo' ./minilibx/libmlx.a(mlx_new_image.o): In functionmlx_int_new_xshm_image': mlx_new_image.c:(.text+0xa7): undefined reference to
XShmCreateImage' mlx_new_image.c:(.text+0x142): undefined reference toXSetErrorHandler' mlx_new_image.c:(.text+0x152): undefined reference to
XShmAttach' mlx_new_image.c:(.text+0x160): undefined reference toXSync' mlx_new_image.c:(.text+0x174): undefined reference to
XSetErrorHandler' mlx_new_image.c:(.text+0x1a0): undefined reference toXCreatePixmap' mlx_new_image.c:(.text+0x1d6): undefined reference to
XSetErrorHandler' mlx_new_image.c:(.text+0x214): undefined reference toXFlush' mlx_new_image.c:(.text+0x23d): undefined reference to
XShmCreatePixmap' ./minilibx/libmlx.a(mlx_new_image.o): In functionmlx_int_new_image': mlx_new_image.c:(.text+0x2c9): undefined reference to
XCreateImage' mlx_new_image.c:(.text+0x305): undefined reference toXCreatePixmap' mlx_new_image.c:(.text+0x324): undefined reference to
XFlush' ./minilibx/libmlx.a(mlx_new_image.o): In functionmlx_new_image': mlx_new_image.c:(.text+0x3fb): undefined reference to
XCreateImage' mlx_new_image.c:(.text+0x43a): undefined reference toXCreatePixmap' mlx_new_image.c:(.text+0x460): undefined reference to
XFlush' ./minilibx/libmlx.a(mlx_new_image.o): In functionmlx_new_image2': mlx_new_image.c:(.text+0x53b): undefined reference to
XCreateImage' mlx_new_image.c:(.text+0x57a): undefined reference toXCreatePixmap' mlx_new_image.c:(.text+0x5a0): undefined reference to
XFlush' ./minilibx/libmlx.a(mlx_put_image_to_window.o): In functionmlx_put_image_to_window': mlx_put_image_to_window.c:(.text+0x33): undefined reference to
XSetClipOrigin' mlx_put_image_to_window.c:(.text+0x6c): undefined reference toXCopyArea' mlx_put_image_to_window.c:(.text+0xd5): undefined reference to
XPutImage' mlx_put_image_to_window.c:(.text+0x113): undefined reference toXShmPutImage' mlx_put_image_to_window.c:(.text+0xb3): undefined reference to
XFlush' ./minilibx/libmlx.a(mlx_clear_window.o): In functionmlx_clear_window': mlx_clear_window.c:(.text+0xb): undefined reference to
XClearWindow' mlx_clear_window.c:(.text+0x25): undefined reference toXFlush' ./minilibx/libmlx.a(mlx_destroy_window.o): In function
mlx_destroy_window': mlx_destroy_window.c:(.text+0x6a): undefined reference toXDestroyWindow' mlx_destroy_window.c:(.text+0x77): undefined reference to
XFreeGC' mlx_destroy_window.c:(.text+0xd1): undefined reference toXFlush' ./minilibx/libmlx.a(mlx_int_param_event.o): In function
mlx_int_param_KeyPress': mlx_int_param_event.c:(.text+0x101): undefined reference toXkbKeycodeToKeysym' ./minilibx/libmlx.a(mlx_int_param_event.o): In function
mlx_int_param_KeyRelease': mlx_int_param_event.c:(.text+0x141): undefined reference toXkbKeycodeToKeysym' ./minilibx/libmlx.a(mlx_int_set_win_event_mask.o): In function
mlx_int_set_win_event_mask': mlx_int_set_win_event_mask.c:(.text+0x2e2): undefined reference toXChangeWindowAttributes' ./minilibx/libmlx.a(mlx_hook.o): In function
mlx_do_key_autorepeatoff': mlx_hook.c:(.text+0x24): undefined reference toXAutoRepeatOff' ./minilibx/libmlx.a(mlx_hook.o): In function
mlx_do_key_autorepeaton': mlx_hook.c:(.text+0x34): undefined reference toXAutoRepeatOn' ./minilibx/libmlx.a(mlx_hook.o): In function
mlx_do_sync': mlx_hook.c:(.text+0x46): undefined reference to `XSync' collect2: error: ld returned 1 exit status