相关疑难解决方法(0)

cimg库 - 链接错误

我尝试使用cimg库.我已经包含了CImg.h-header文件.但是当我尝试编译它时,我收到链接错误.

/tmp/cc2tvYsW.o: In function `cimg_library::cimg::Mutex_info::trylock(unsigned int)':
tafelbilder.cpp:(.text._ZN12cimg_library4cimg10Mutex_info7trylockEj[_ZN12cimg_library4cimg10Mutex_info7trylockEj]+0x2b): undefined reference to `pthread_mutex_trylock'
/tmp/cc2tvYsW.o: In function `cimg_library::CImgDisplay::screen_width()':
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay12screen_widthEv[_ZN12cimg_library11CImgDisplay12screen_widthEv]+0x2c): undefined reference to `XOpenDisplay'
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay12screen_widthEv[_ZN12cimg_library11CImgDisplay12screen_widthEv]+0x98): undefined reference to `XCloseDisplay'
/tmp/cc2tvYsW.o: In function `cimg_library::CImgDisplay::screen_height()':
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay13screen_heightEv[_ZN12cimg_library11CImgDisplay13screen_heightEv]+0x2c): undefined reference to `XOpenDisplay'
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay13screen_heightEv[_ZN12cimg_library11CImgDisplay13screen_heightEv]+0x98): undefined reference to `XCloseDisplay'
/tmp/cc2tvYsW.o: In function `cimg_library::CImgDisplay::_handle_events(_XEvent const*)':
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0xc7): undefined reference to `XUnmapWindow'
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x12a): undefined reference to `XCheckWindowEvent'
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x218): undefined reference to `XResizeWindow'
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x2f5): undefined reference to `XCheckWindowEvent'
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x348): undefined reference to `XGetWindowAttributes'
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x35e): undefined reference to `XSync'
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x390): undefined reference to `XSetInputFocus'
tafelbilder.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x4ce): …
Run Code Online (Sandbox Code Playgroud)

c++ linker cimg

3
推荐指数
1
解决办法
2553
查看次数

无法使用CImg加载任何图像

每当我尝试加载图像时,都会出现错误提示CImg<unsigned char>::load(): Failed to recognize format of file。jpg和png文件都会发生这种情况。

我找到了关于这个说法的其他帖子来定义cimg_use_pngcimg_use_jpeg,但是然后我遇到编译错误告诉我我需要png.njpeglib.h。不知道我应该从哪里得到这些。

我不确定我哪里出了问题,所以我不知道具体要问些什么。怎么了?

c++ libjpeg cimg

0
推荐指数
1
解决办法
2027
查看次数

标签 统计

c++ ×2

cimg ×2

libjpeg ×1

linker ×1