Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux Cimg链接eclipse错误_Linux_Eclipse_Gcc_Cimg - Fatal编程技术网

Linux Cimg链接eclipse错误

Linux Cimg链接eclipse错误,linux,eclipse,gcc,cimg,Linux,Eclipse,Gcc,Cimg,在ubuntu eclipse中,我想使用img库: 我的g++选项: -I"/home/lukas/Desktop/ressss/resolution_F/re_fol/CImgLib" -I"/home/lukas/Desktop/ressss/resolution_F/re_fol/Eigen" -O0 -g3 -Wall -c -fmessage-length=0 -L/usr/X11R6/lib -lm -lpthread -lX11 -lX11 -ltif

在ubuntu eclipse中,我想使用img库:

我的g++选项:

   -I"/home/lukas/Desktop/ressss/resolution_F/re_fol/CImgLib"
    -I"/home/lukas/Desktop/ressss/resolution_F/re_fol/Eigen" -O0 -g3 -Wall
   -c -fmessage-length=0 -L/usr/X11R6/lib -lm -lpthread -lX11   -lX11
  -ltiff -ljpeg -lpng -llapack -lGLU -lGL -ldc1394  -L -lXext -pthread
仍然会收到此错误:

make all
Building target: resolution_F
Invoking: GCC C++ Linker

g++ -L/home/lukas/Desktop/CImg-1.7.1_pre033116 -o"resolution_F"
./re_fol/core.o ./re_fol/resolution_F.o
./re_fol/core.o: In function
`cimg_library::cimg::Mutex_info::trylock(unsigned int)':
/home/lukas/Desktop/ressss/resolution_F/Debug/../re_fol/CImg.h:2875:
undefined reference to `pthread_mutex_trylock'
./re_fol/core.o: In function `cimg_library::CImgDisplay::screen_width()':
/home/lukas/Desktop/ressss/resolution_F/Debug/../re_fol/CImg.h:7178:
undefined reference to `XOpenDisplay'
/home/lukas/Desktop/ressss/resolution_F/Debug/../re_fol/CImg.h:7182:
undefined reference to `XCloseDisplay'
./re_fol/core.o: In function `cimg_library::CImgDisplay::screen_height()':
/home/lukas/Desktop/ressss/resolution_F/Debug/../re_fol/CImg.h:7199:
undefined reference to `XOpenDisplay'

/home/lukas/Desktop/ressss/resolution_F/Debug/../re_fol/CImg.h:7203:
undefined reference to `XCloseDisplay'
./re_fol/core.o: In function
`cimg_library::CImgDisplay::_handle_events(_XEvent const*)':
/home/lukas/Desktop/ressss/resolution_F/Debug/../re_fol/CImg.h:7230:
undefined reference to `XUnmapWindow'
/home/lukas/Desktop/ressss/resolution_F/Debug/../re_fol/CImg.h:7236:

我尝试了一切。重启,许多选项,…gcc 4.6或gcc 4.7…

您需要将代码与X11和pthread库链接起来。 可能您只需要在项目首选项的某个位置添加这些编译器选项:

-lpthread -lX11