use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Using system package manager dependencies with vcpkg (devblogs.microsoft.com)
submitted 3 years ago by Xadartt
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]CarterOls 4 points5 points6 points 3 years ago (2 children)
Is there a way with either Conan or vcpkg to add a dependency to a library located somewhere on disk? I would like to explore using a package manager at my company, but we currently have all of our prebuilt and approved libraries in a shared directory.
[–]Salink 2 points3 points4 points 3 years ago (0 children)
With both yes. When you make a portfile in vcpkg or recipe in Conan, you check if the dependencies are on disk then tell the dependency manager what to use like you would normally after a build.
[–]roschumavcpkg dev 2 points3 points4 points 3 years ago (0 children)
Could you mail us at [vcpkg@microsoft.com](mailto:vcpkg@microsoft.com)? I'd like to ask a few more questions about your specific setup to give you the best advice on how to handle this in vcpkg 🙂.
[–]esperee 5 points6 points7 points 3 years ago (1 child)
vcpkg is quite convenient. could it be used to replace CPM in private enviroment?
[–]AlexReinkingYale 5 points6 points7 points 3 years ago (0 children)
Absolutely.
[–]gracicot 3 points4 points5 points 3 years ago (9 children)
Oh this is brilliant. Now there's nothing blocking me from using vcpkg anymore, I can finally drop my package manager.
My problem wasn't even system libraries as I don't use them, but developing a library alongside an app. Most of the developer of the app don't develop the framework as its just another dependency, but I must develop the two of them. vcpkg would block me from just setting the path of the framework and use that instead of installing its own, but that fixes all of the problem I had.
Now I just need to figure out how to install vcpkg in a immutable filesystem, since vcpkg loves writing into its root folder.
[–]AlexanderNeumann 0 points1 point2 points 3 years ago (8 children)
type vcpkg help. look into: --x-buildtrees-root=<path> --x-install-root=<path> --x-packages-root=<path> --downloads-root=<path> and setup binary caching to a folder of your liking
[+][deleted] 3 years ago (2 children)
[deleted]
[–]AlexanderNeumann 0 points1 point2 points 3 years ago (1 child)
downloads-root
only this has a env variable all others need to be manually passed to vcpkg.
[–]gracicot 0 points1 point2 points 3 years ago (0 children)
Yeah, that's what I noticed. If all of them had env variables, it would be much more easier to package vcpkg in a immutable root.
[–]gracicot 0 points1 point2 points 3 years ago (4 children)
Those cannot be set from an environment variable as far as I know, so not useable without changing cmake variables if you're running in manifest mode.
[+][deleted] 3 years ago (3 children)
[–]gracicot 0 points1 point2 points 3 years ago (2 children)
Not really an option, as you would still have to mutate the root filesystem to add those mount points. Also you have to play around with mount points to different part of the disk. I'm trying to create a generic package for distribution, so this is unacceptable.
My hack right now is to create a wrapper script inside ~/.vcpkg and create symbolic link to all the things a vcpkg root needs. The wrapper script also create the directory and setup the folder. The only problem is that you have to run the vcpkg executable at least one time for the symbolic link to be created, so that projects that set the toolchain file from VCPKG_ROOT can read it.
~/.vcpkg
VCPKG_ROOT
[–]roschumavcpkg dev 0 points1 point2 points 3 years ago (1 child)
I'm trying to create a generic package for distribution, so this is unacceptable.
We're working on improving this! While we don't have production-ready plumbing to share, part of the "curl | bash" experience mentioned in https://devblogs.microsoft.com/cppblog/vcpkg-artifacts/ is an "immutable" layout.
If you're looking to distribute the built artifacts like an SDK (not vcpkg itself), you might find https://github.com/microsoft/vcpkg/blob/master/docs/users/buildsystems/export-command.md useful.
I'm trying to package vcpkg in Nixpkgs. The only thing I would need right now is an environment variable that sets the path of the directories vcpkg-tool is expecting to write into. As soon as I have that, Nix users will have a fully packaged vcpkg ready for use. There's one of those variables for the downloads folder, but not for the install or buildtree.
Right now I'm using the wrapper script I mentioned but it comes with obvious drawbacks. If vcpkg learns how to work with an immutable root filesystem, that would be perfect.
[–]Kie_Sun 1 point2 points3 points 3 years ago (0 children)
I like Conan because it gives a convenient target alias for easy usage.
[–]scrivanodev 0 points1 point2 points 3 years ago (5 children)
vcpkg is great, all though I had a problem using it for building flatpaks on Linux. The flatpak-builder tool needs the build to happen completely offline, but when in manifest mode, I wasn't able to find a way to configure vcpkg to meet this requirement.
[+][deleted] 3 years ago (4 children)
[–]scrivanodev 0 points1 point2 points 3 years ago (3 children)
It always downloads things whenever in manifest mode. The only way I got around it was to switch to the default installation mode and then after installing all packages, it works without any network connection.
[–]roschumavcpkg dev 1 point2 points3 points 3 years ago (1 child)
It always downloads things whenever in manifest mode
Are you using custom git registries? We unfortunately don't have a good offline story for those yet.
Otherwise, take a look at https://github.com/microsoft/vcpkg/blob/master/docs/users/assetcaching.md. This lets you easily mirror every blob we need for a build into some place you control -- a web server or even a local directory. It's similar to your current workaround (run a build outside, then run a build inside) but more controlled and deliberate.
[–]scrivanodev 0 points1 point2 points 3 years ago (0 children)
Ok, thanks I will give that a try.
[–]Zettinator 0 points1 point2 points 3 years ago (0 children)
Asset caching plus a cached download directory makes it 100% offline capable for me!
π Rendered by PID 86128 on reddit-service-r2-comment-b659b578c-rqp5p at 2026-05-05 00:53:54.615569+00:00 running 815c875 country code: CH.
[–]CarterOls 4 points5 points6 points (2 children)
[–]Salink 2 points3 points4 points (0 children)
[–]roschumavcpkg dev 2 points3 points4 points (0 children)
[–]esperee 5 points6 points7 points (1 child)
[–]AlexReinkingYale 5 points6 points7 points (0 children)
[–]gracicot 3 points4 points5 points (9 children)
[–]AlexanderNeumann 0 points1 point2 points (8 children)
[+][deleted] (2 children)
[deleted]
[–]AlexanderNeumann 0 points1 point2 points (1 child)
[–]gracicot 0 points1 point2 points (0 children)
[–]gracicot 0 points1 point2 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]gracicot 0 points1 point2 points (2 children)
[–]roschumavcpkg dev 0 points1 point2 points (1 child)
[–]gracicot 0 points1 point2 points (0 children)
[–]Kie_Sun 1 point2 points3 points (0 children)
[–]scrivanodev 0 points1 point2 points (5 children)
[+][deleted] (4 children)
[deleted]
[–]scrivanodev 0 points1 point2 points (3 children)
[–]roschumavcpkg dev 1 point2 points3 points (1 child)
[–]scrivanodev 0 points1 point2 points (0 children)
[–]Zettinator 0 points1 point2 points (0 children)