X11/extensions/Xcomposite.h:没有那个文件或目录

Grz*_*cki 3 xorg programming compiling c++

我尝试在 Ubuntu 下编译https://unix.stackexchange.com/a/228674

不幸的是,最终出现以下错误:

/tmp/find-cursor$ make
cc find-cursor.c -o find-cursor -lX11
find-cursor.c:19:39: fatal error: X11/extensions/Xcomposite.h: No such file or directory
 #include <X11/extensions/Xcomposite.h>
                                       ^
compilation terminated.
make: *** [all] Error 1
Run Code Online (Sandbox Code Playgroud)

我试过以下嫌疑人:

$ sudo apt-get install libxtst-dev libxss-dev libxtst6-dbg libxext6-dbg libxss1-dbg
Run Code Online (Sandbox Code Playgroud)

但在编译时仍然没有运气。为了您的方便,这里是片段:

sudo apt-get install mercurial
cd /tmp
hg clone https://bitbucket.org/Carpetsmoker/find-cursor
cd find-cursor
make
Run Code Online (Sandbox Code Playgroud)

解决了:

FTR:要编译上面的代码,我必须: sudo apt-get install libxcomposite-dev libxdamage-dev libxrender-dev-std=gnu99在 Makefile 中向 cc添加标志

Sco*_*and 12

每当编译失败并丢失文件时,只需利用基础设施来搜索丢失的 ubuntu 包

apt-file search   some_missing_file_goes_here   #  cmd 1    
apt-file search   X11/extensions/Xcomposite.h   #  cmd 1
Run Code Online (Sandbox Code Playgroud)

返回

libxcomposite-dev: /usr/include/X11/extensions/Xcomposite.h
Run Code Online (Sandbox Code Playgroud)

所以解决方案是安装那个丢失的包

sudo apt-get install libxcomposite-dev              #  cmd 2
Run Code Online (Sandbox Code Playgroud)

此技术适用于任何丢失的文件


在新的操作系统上,如果您发出

apt-file search   X11/extensions/Xcomposite.h  
Run Code Online (Sandbox Code Playgroud)

它会因错误而失败

The program 'apt-file' is currently not installed. To run 'apt-file' please ask your administrator to install the package 'apt-file'
Run Code Online (Sandbox Code Playgroud)

这只是意味着您需要对本地搜索缓存进行一次性设置,因此只需运行

sudo apt-get install apt-file -y
sudo apt-file update
Run Code Online (Sandbox Code Playgroud)

现在重新发出上面显示的搜索(cmd 1)然后安装包(cmd 2)

  • 这是一个绝妙的答案。我对未来的问题感到畅通无阻。 (4认同)