In C++ projects, tracking down the origin of a particular file can be just as important as managing dependencies. When multiple libraries are installed, it is not always obvious which package provides a specific header or other file. The vcpkg tool includes a convenient option that helps identify which package a file belongs to. This capability is especially useful when debugging build issues or exploring unfamiliar codebases. This tutorial explains how to find which C++ package contains specific file using vcpkg.
The owns option searches through installed packages and returns those that contain files matching a given name or pattern.
For example, to determine which package provides the png.h header file, run the following command:
vcpkg owns png.h
The command produces a list of matching files along with the packages that include them:
libpng:x64-linux: x64-linux/include/libpng16/png.h
libpng:x64-linux: x64-linux/include/png.h
Each line shows the package name, target triplet, and the path to the file within the installed directory. In this case, the output indicates that the png.h file is supplied by the libpng package.
Leave a Comment
Cancel reply