编译时遇到错误大都是找不到某个文件,解决办法就是找出该文件在哪个软件包里、然后安装包就可以,这个技巧是属于包管理器范畴,所以各个发行版会有差异,ArchLinux用pacman -F解决,Debian/Ubuntu可以用apt-file(请参考
https://wiki.ubuntu.com/AptFile),下面我举个例子:
```
CMake Error at /usr/lib64/cmake/Qt5/Qt5Config.cmake:26 (find_package):
Could not find a package configuration file provided by "Qt5LinguistTools"
with any of the following names:
Qt5LinguistToolsConfig.cmake
qt5linguisttools-config.cmake
Add the installation prefix of "Qt5LinguistTools" to CMAKE_PREFIX_PATH or
set "Qt5LinguistTools_DIR" to a directory containing one of the above
files. If "Qt5LinguistTools" provides a separate development package or
SDK, be sure it has been installed.
Call Stack (most recent call first):
cmake/QtChooser.cmake:1 (find_package)
lib/quazip/CMakeLists.txt:6 (include)
```
这提示是说找不到Qt5LinguistToolsConfig.cmake 或者 qt5linguisttools-config.cmake
第一次使用pacman -F 或者 apt-file 都需要更新数据库,下次使用可以略过这个步骤:
`$ sudo pacman -Fy` 或者 `$ sudo apt-file update`
找文件得到结果:
```
$ pacman -Fs Qt5LinguistToolsConfig.cmake
extra/qt5-tools 5.7.0-1
usr/lib/cmake/Qt5LinguistTools/Qt5LinguistToolsConfig.cmake
```
或者 `$ apt-file search Qt5LinguistToolsConfig.cmake`