1

I am new to CPP and I find the lack of proper package management quite cumbersome how can I use the library cpr with vcpkg?

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install cpr

I have done these steps and still I can't use cpr library in my code. What else do I have to do?

  • Can you elaborate on "can't use"? – HolyBlackCat Apr 06 '22 at 22:28
  • Compiler doesn't even know what cpr is during the include part –  Apr 06 '22 at 22:29
  • fatal error: cpr/cpr.h: No such file or directory –  Apr 06 '22 at 22:29
  • I don't use vcpkg, but I assume there are lots of dupes on getting packages working. And probably full tutorials available online. – Stephen Newell Apr 06 '22 at 22:29
  • All tutorials use different kind of methods and I also was not able to get them work. What do you use? How would you build the binaries? –  Apr 06 '22 at 22:31
  • I think you need to put `./vcpkg integrate install` last. Although with that said I do use vcpkg and Visual Studio 2019 but not this command. All of my code uses CMake to generate VS projects. – drescherjm Apr 06 '22 at 22:31
  • 1
    ***How would you build the binaries?*** If you did `./vcpkg install cpr` you already did that. Your issue is setting your include path and linking. – drescherjm Apr 06 '22 at 22:32
  • The vcpkg documentation for Visual Studio Community / Enterprise/ Pro is here: [https://github.com/microsoft/vcpkg#quick-start-windows](https://github.com/microsoft/vcpkg#quick-start-windows) Note there are different instructions for VSCode which is a completely different IDE. – drescherjm Apr 06 '22 at 22:33
  • I did the integration with vcpkg and it is supposed to do the linking automatically? but it doesn't and compiler still can't recognize the library –  Apr 06 '22 at 22:54
  • Did you run the "vcpkg integrate install" command in a shell that was running as admin? (That is, elevated)? – SoronelHaetir Apr 06 '22 at 23:19
  • Yep I have and it produces the same result –  Apr 07 '22 at 00:37
  • 1
    Please add more description to your question: What is your IDE? Are you using Visual Studio or VS Code? Are you using CMake/Meson/Autotools? The answers to these questions is required to even remotely answer your question correctly. – Alexander Neumann Apr 07 '22 at 07:50

1 Answers1

1

Close Visual Studio IDE. Use correct triplets. Confirm if your project need a static or dynamic linking or if it is 32 bit or 64 bit. Wrong project settings may lead to unwonted results. Assuming you selected 64bits in your project settings, issue the following command under Windows PowerShell. integrate install command should be issued after installation.

cd vcpkg
./vcpkg install cpr:x64-windows
./vcpkg integrate install
ark1974
  • 615
  • 5
  • 16