X11/Xlib.h:没有该文件或目录

编译程序时出现的错误, 在安装日志上发现一句:x11/xlib.h nosuch file or directory 在网上查阅了资料,原来是x11M没有装。

解决方案:
先安装X11,命令为    sudo apt -get install libx11-dev 
结果仍然出错如下:
checking for main in -lXbsd... no
checking for socket in -lsocket... no
checking for gethostbyname in -lnsl... yes
checking for dcgettext in -lintl... no
checking for getnodebyname in -ldnet_stub... no
checking that g++ can handle -O2... no
checking standard STL is available... no
checking for tcl.h... -I../include
checking for tclInt.h... -I../include
checking for libtcl8.4... -L../lib -ltcl8.4
checking for init.tcl... ../lib/tcl8.4
checking for http.tcl... ../lib/tcl8.4/http1.0
checking Tcl http.tcl library... yes
checking for tclsh8.4.11... no
checking for tclsh8.4... ../bin/tclsh8.4
checking for tk.h... -I../include
checking for libtk8.4... -L../lib -ltk8.4
checking for tk.tcl... ../lib/tk8.4
checking for X11 header files
can't find X includes
otcl-1.12 configuration failed! Exiting ...
Please check http://www.isi.edu/nsnam/ns/ns-problems.html
for common problems and bug fixes.
还是没有得到解决.分析了一下可能是x11没有安装完整,于是先输入:sudo apt-cache search x11-dev

linzchey@linzchey-laptop:~/CODES/$ sudo apt-cache search x11-dev
libgl1-mesa-swx11-dev - A free implementation of the OpenGL API -- development files
libghc6-x11-dev - Haskell X11 binding for GHC
libgtkglextmm-x11-dev - C++ wrapper for the OpenGL Extension to GTK (development files)
libx11-dev - X11 client-side library (development headers)

分别安装上面的组件,命令如下:
sudo apt-get install libx11-dev
sudo apt-get install libgtkglextmm-x11-dev
sudo apt-get install libghc6-x11-dev
sudo apt-get install libgl1-mesa-swx11-dev

或者在新得立中:搜索 -> 标记以安装 -> 应用, 即可。


在Ubuntu8.04中,安装完毕后的 X11/Xlib.h的路径是:/usr/include/X11/Xlib.h

你可能感兴趣的:(lib)