1 vcpkg下载安装(windows)
vcpkg是微软开发的一个c++扩展工具,直接在GitHub上就可以下载。
下载之后,打开vcpkg-master,双击里面的bootstrap-vcpkg.bat即可。
出现vcpkg.exe文件时,代表安装成功。
2 vcpkg添加到环境变量
右键“此电脑”,选择属性,点击高级系统设置,点击环境变量。
在系统环境变量中双击Path,将vcpkg.exe所在的文件夹复制进去,如图所示。
然后一路确定就可以了。
3 vcpkg常用命令
1-搜索所有的第三方库
vcpkg search
2-搜索指定的第三方库
vcpkg.exe search | findstr fann
3-安装库
vcpkg install fann
4-卸载库
vcpkg remove jsoncpp
5-集成库到VS2019
vcpkg integrate install
如果集成失败的话,大概率是由于VS不是英文包,从VS installer那里修改语言包为英文即可。
6-其他命令:
Commands:
vcpkg search [pat] Search for packages available to be built
vcpkg install <pkg>... Install a package
vcpkg remove <pkg>... Uninstall a package
vcpkg remove --outdated Uninstall all out-of-date packages
vcpkg list List installed packages
vcpkg update Display list of packages for updating
vcpkg upgrade Rebuild all outdated packages
vcpkg x-history <pkg> (Experimental) Shows the history of CONTROL versions of a package
vcpkg hash <file> [alg] Hash a file by specific algorithm, default SHA512
vcpkg help topics Display the list of help topics
vcpkg help <topic> Display help for a specific topic
vcpkg integrate install Make installed packages available user-wide. Requires admin
privileges on first use
vcpkg integrate remove Remove user-wide integration
vcpkg integrate project Generate a referencing nuget package for individual VS project use
vcpkg integrate powershell Enable PowerShell tab-completion
vcpkg export <pkg>... [opt]... Exports a package
vcpkg edit <pkg> Open up a port for editing (uses %EDITOR%, default 'code')
vcpkg import <pkg> Import a pre-built library
vcpkg create <pkg> <url> [archivename]
Create a new package
vcpkg owns <pat> Search for files in installed packages
vcpkg depend-info <pkg>... Display a list of dependencies for packages
vcpkg env Creates a clean shell environment for development or compiling
vcpkg version Display version information
vcpkg contact Display contact information to send feedback
Options:
--triplet <t> Specify the target architecture triplet. See 'vcpkg help triplet'
(default: %VCPKG_DEFAULT_TRIPLET%)
--overlay-ports=<path> Specify directories to be used when searching for ports
(also: %VCPKG_OVERLAY_PORTS%)
--overlay-triplets=<path> Specify directories containing triplets files
--binarysource=<path> Add sources for binary caching. See 'vcpkg help binarycaching'
--downloads-root=<path> Specify the downloads root directory
(default: %VCPKG_DOWNLOADS%)
--vcpkg-root <path> Specify the vcpkg root directory
(default: %VCPKG_ROOT%)
--x-buildtrees-root=<path> (Experimental) Specify the buildtrees root directory
--x-install-root=<path> (Experimental) Specify the install root directory
--x-packages-root=<path> (Experimental) Specify the packages root directory
--x-scripts-root=<path> (Experimental) Specify the scripts root directory
--x-json (Experimental) Request JSON output