Step by Step Tutorial Link: gamefromscratch.com/vcpkg-cpp-easy-mode-step-by-step-tutorial/ Timeline: 0:01 Introduction and overview 1:07 Getting your compiler and other pieces installed 4:30 Installing VCPKG 8:08 Searching for and installing packages 11:44 Using a VCPKG in Visual Studio 15:18 Installing and configuring Visual Studio Code 18:57 Creating your Visual Studio Code based CMake project 20:30 Configuring Code to work with VCPKG 23:46 Creating your Run configuration 24:41 Compiling a Raylib project 25:50 A few more CMakeFiles.txt tweaks
I'm still quite new with C++ and have noticed that it is a boring and arduous process to manually setup libraries which made me find out about VCPKG. I've looked through numerous videos to be left confused with a lot of question and little clarification. But your video has clarified my confusion and has gotten everything to work for me. Thanks a ton!
This is an absolute lifesaver kind sir. I tried to get it running an year ago but failed, miserably. I'm 100% sure I couldn't have figured it out with your video. Appreciation and gratitude from the bottom of my heart.
My build system didn’t appreciate me uninstalling and reinstalling to make the video, that actually happens quite a lot, I get something figured out, uninstall to start from scratch for the video and some leftovers mess it up. In this case it was cmake caching
We definitely could use a package manager for C++. Conan looks like another good one. I use MSYS2, which uses the pacman package manager. It has over 1800 packages but sadly no raylib.
Vcpkg is pretty good, just be aware that although it builds every library locally, it does not work very well for non-usual platforms. I tried to compile a simple C++ game on a Raspberry Pi for my children to play and experiment with, but I never got vcpkg to work and I ended up using the apt-get version of the bigger libs and directly including the code of the smaller libraries directly in the project. It's not a big deal and I really can't fault Microsoft for not putting engineer time on exotic platforms, but it's something to be aware of if you're going to depend on vcpkg to manage your project's libraries.
For visual studio, I tried installing a package (gtkmm) which depends on other packages. Vcpkg installed all of them, but when I go to compile in visual studio, it cannot locate the other package headers. Having to individually include each package seems insane (there are several dozen of them). Is there something else that needs to be done for packages that are more than a single header?
Does vcpkg have similar functionality as CMAKE where you can keep all your project files and build stuff separate from your source for clean source control with visual studio? So you don't need to include libraries. Or do you have to use VS Code the way you did here to make that so easy? And can you use the step-through debugger seeing as it's the Release mode compiler that VS Code seems to autodetect?
Darshan Phaldesai I don’t think so, he’s just stressing that that’s a useful feature you’re going to want to get used to using if you work with VSCode.
I followed the tutorial step by step from vs code editor, but I am having this error "LINK : fatal error LNK1104: cannot open file 'boost.lib' [C:\Users\USER\Desktop\cpp1\build\cpp1.vcxproj]", Dont understand why this thing is happening, Tried many stackoverflow threads but most of them are explaining for Visual studio IDE. Please NEED HELP.
know you didn't ask but from my experience For c++ on windows, VScode is unusable so full VS it is. But VScode is decent on Linux and Mac. But there are better IDEs on those platforms. For JS/Python, VScode is arguably the best IDE for those languages.
VSCode is great for training when students are using their own machines which can be Win/Linux/Mac. It is similar to Eclipse which runs a virtual environment that looks the same on all OSs. Other than that, no real need to use it that I've seen.
I used VS Code for Unity which is a very good substitute for Unity Monodevelop after it got taken down. It may not have too many features but there are alot plugins and stuffs for any scripting also its storage allocation is light, very light. It's designed for access efficiency and lightweight. VS Code = Good for scripting and editing, VS = Best for programming.
Is it easier to work with C++ dependencies on Linux? I’m considering switching to MacOS because of the UNIX core, would that also help with C++ development?
Omar Abdulla, not exactly dependencies, but almost everything will be easier, for instance you don’t need to install a huge beast like visual studio just to compile c++, you just install gcc or clang, although most development on macOS requires Xcode, which is hardly any better than visual studio, on linux nothing is required, you just find the tool(s) you like with the features you want, get to making things, nothing getting in your way
skaruts, Yes! You can use a set of tools called MinGW - Minimalist GNU for Windows, the same GNU as in gnu/linux, allowing you to use gcc to compile windows binaries from linux or windows. Its my preferred toolchain for windows since its free and open source.
I dont see what the problem is about adding a few headers and linking libraries, its pretty much a prerequisite for beginners to do this to learn the language and how things work, I do see the benefit for experienced users to streamline their workflow, but it seems like a fair bit of hassle to setup.
How to fix "No suitable Visual Studio instances were found" when downloading nuget?? This problem occur when running command : .\vcpkg.exe install raylib:x64-windows
Did he ever fix that typo with scripts/buildsystems/vcpkg.cmake ? it has cmake extension for me, and it was so for years, and he used .make . Is that cause why all that wizardry with variables is required?
I’m giving this a try soon when I get some free time, I hope it works and maybe then I can finally build something with C++. The dependency stuff has always driven me away from C++. Looking at Pip, npm, and nuget, the package and dependency management in C++ just seems like a complete joke.
After watching the video I wrote how I setup c builds on windows here gist.github.com/LiamSwarbrick/96bb3236f85a81761b0b9695107f295b I find using just a batch file that calls the compiler once to be very simple. and makes adding libs like raylib easy (even though its c it shouldn't be much different to c++, change gcc to g++ etc..)
@@MiiDev69 a number of Languages claim to be direct successors, including D, and C#. IMHO, C# is almost always a better choice (especially for large projects, or where SDLC is a consideration). But I understand it's not always an option.
@@BrainSlugs83 I figured that C# might end up being my application building go-to language till I picked up Rust. Performance is much more on par with C/C++, automatic memory deallocation without any hindrance of a garbage collector, all the modern memory protections, data race prevention, the list goes on... I don't even miss C#, to be honest.
Michael Jensen I love C#, it’s honestly an amazing language and I’ve been using it for the last couple of months on a project I was working on, but you also have to remember that it’s a higher level language that isn’t suitable to replace a lower level language like C++. In the project I was working on we relied heavily on struct bitfields when it came to storing data and reading data. There was no native support for bitfields in C# in any capacity, and we had to do a lot of Boolean arithmetic to simulate bitfields which I’ll admit made things a little slower.
I am getting the following error while running the this command: .\vcpkg.exe integrate install .\vcpkg.exe : The term '.\vcpkg' is not recognized as the name of a cmdlet, function, script file, or operable program. Che ck the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + .\vcpkg integrate install + ~~~~~~~ + CategoryInfo : ObjectNotFound: (.\vcpkg.exe:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Step by Step Tutorial Link:
gamefromscratch.com/vcpkg-cpp-easy-mode-step-by-step-tutorial/
Timeline:
0:01 Introduction and overview
1:07 Getting your compiler and other pieces installed
4:30 Installing VCPKG
8:08 Searching for and installing packages
11:44 Using a VCPKG in Visual Studio
15:18 Installing and configuring Visual Studio Code
18:57 Creating your Visual Studio Code based CMake project
20:30 Configuring Code to work with VCPKG
23:46 Creating your Run configuration
24:41 Compiling a Raylib project
25:50 A few more CMakeFiles.txt tweaks
Nice
such a good video.. to the point
Oww, i spend 3 hours yesterday trying to make raylib work in VSCode, and didnt made it. Thank you!
I thoroughly enjoy seeing your recents on C:\temp
Lol what a coincidence for me, I was just starting to learn C++
same
The last thing you want to do when you start learning C++ is messing with libs
@@felixinfinita3777 it is the pain of C++, specially when learning to use Visual Studio options.
I'm still quite new with C++ and have noticed that it is a boring and arduous process to manually setup libraries which made me find out about VCPKG. I've looked through numerous videos to be left confused with a lot of question and little clarification. But your video has clarified my confusion and has gotten everything to work for me. Thanks a ton!
Even tho I know most of c++ I have never been able to install libraries since I didn't get how, you are a lifesaver sir thank you so much.
git clone --depth=1 to avoid downloading the entire git repository
+1 for that :-)
Heads up: Putting a project on GitHub with a CMake that references your own locally installed deps is not good.
The Visual Studio Code part is really really very helpful.
I've been trying to figure this out for days. This video is a lifesaver. Thank you.
This is an absolute lifesaver kind sir. I tried to get it running an year ago but failed, miserably. I'm 100% sure I couldn't have figured it out with your video. Appreciation and gratitude from the bottom of my heart.
Thanks, great tutorial. I spent about 3 days trying to do all this, and nothing. With your video I did it in 30 min
amazing, I love c++ but the library management has always been a real problem for me. Thank you so much :)
Omfg, thank you so much. I was trying to figure this out for hours...
Wow. Very powerful. Thank you Sir.
Holy Shit!, just to say hello world in c++, 15min tutorial is needed. DAMN!
Bahahah
Love the "Recent" list at 18:04. I'm guessing there was a few cracks at this before the video got made?
My build system didn’t appreciate me uninstalling and reinstalling to make the video, that actually happens quite a lot, I get something figured out, uninstall to start from scratch for the video and some leftovers mess it up. In this case it was cmake caching
your a saviour
We definitely could use a package manager for C++. Conan looks like another good one. I use MSYS2, which uses the pacman package manager. It has over 1800 packages but sadly no raylib.
Vcpkg is pretty good, just be aware that although it builds every library locally, it does not work very well for non-usual platforms. I tried to compile a simple C++ game on a Raspberry Pi for my children to play and experiment with, but I never got vcpkg to work and I ended up using the apt-get version of the bigger libs and directly including the code of the smaller libraries directly in the project. It's not a big deal and I really can't fault Microsoft for not putting engineer time on exotic platforms, but it's something to be aware of if you're going to depend on vcpkg to manage your project's libraries.
Yeah, if you're using Linux, there are more established (non-cross platform) options. This is more to fill the gap for Windows users I think.
Now I can debug my Raylib code
Does this come with an "Easy" button? :-)
Two words: HELL. YES
finally i found what i want
omg i wish i know this 3 years before ;(
That was super cool!
For visual studio, I tried installing a package (gtkmm) which depends on other packages. Vcpkg installed all of them, but when I go to compile in visual studio, it cannot locate the other package headers.
Having to individually include each package seems insane (there are several dozen of them). Is there something else that needs to be done for packages that are more than a single header?
very nice tutorial!
Thanks guy
Looks handy !
Heh, could've used one of these a few years ago...
Does vcpkg have similar functionality as CMAKE where you can keep all your project files and build stuff separate from your source for clean source control with visual studio? So you don't need to include libraries. Or do you have to use VS Code the way you did here to make that so easy? And can you use the step-through debugger seeing as it's the Release mode compiler that VS Code seems to autodetect?
18:10 your frustrations are visible :p
Darshan Phaldesai I don’t think so, he’s just stressing that that’s a useful feature you’re going to want to get used to using if you work with VSCode.
@@xinaesthetic No no, you did not see his recent projects lol
@@ChonkyWantsACat I stand corrected. 😄
I'm glad to see the frustrated naming scheme of fuck2 and fuckthisshit when he opened VSCode
Oops. ;)
I followed the tutorial step by step from vs code editor, but I am having this error "LINK : fatal error LNK1104: cannot open file 'boost.lib' [C:\Users\USER\Desktop\cpp1\build\cpp1.vcxproj]", Dont understand why this thing is happening, Tried many stackoverflow threads but most of them are explaining for Visual studio IDE. Please NEED HELP.
OMG!! I miss pip install :(
Do you prefer VS Code or VS ? Btw nice video
know you didn't ask but from my experience
For c++ on windows, VScode is unusable so full VS it is. But VScode is decent on Linux and Mac. But there are better IDEs on those platforms.
For JS/Python, VScode is arguably the best IDE for those languages.
For C++, Visual Studio, Visual Studio Code features just aren't quite there yet. For an editor or small projects, Visual Studio Code 100%
VSCode is great for training when students are using their own machines which can be Win/Linux/Mac. It is similar to Eclipse which runs a virtual environment that looks the same on all OSs. Other than that, no real need to use it that I've seen.
I used VS Code for Unity which is a very good substitute for Unity Monodevelop after it got taken down. It may not have too many features but there are alot plugins and stuffs for any scripting also its storage allocation is light, very light. It's designed for access efficiency and lightweight. VS Code = Good for scripting and editing, VS = Best for programming.
Real programmers use Vim
I'm actually really surprised at the amount of effort needed on windows compared to Linux
It's terrible. After switching to Linux life was great
Is it easier to work with C++ dependencies on Linux? I’m considering switching to MacOS because of the UNIX core, would that also help with C++ development?
Omar Abdulla, not exactly dependencies, but almost everything will be easier, for instance you don’t need to install a huge beast like visual studio just to compile c++, you just install gcc or clang, although most development on macOS requires Xcode, which is hardly any better than visual studio, on linux nothing is required, you just find the tool(s) you like with the features you want, get to making things, nothing getting in your way
Can you compile for windows from linux?
skaruts, Yes! You can use a set of tools called MinGW - Minimalist GNU for Windows, the same GNU as in gnu/linux, allowing you to use gcc to compile windows binaries from linux or windows. Its my preferred toolchain for windows since its free and open source.
18:20 recent projects make it seem like you were having a bad time :D
I dont see what the problem is about adding a few headers and linking libraries, its pretty much a prerequisite for beginners to do this to learn the language and how things work, I do see the benefit for experienced users to streamline their workflow, but it seems like a fair bit of hassle to setup.
composer came out in 2012 for php,
they should have done this a long time ago for c++ xd
How to fix "No suitable Visual Studio instances were found" when downloading nuget??
This problem occur when running command : .\vcpkg.exe install raylib:x64-windows
9:43 lol, well at least it's there 😅
Did he ever fix that typo with scripts/buildsystems/vcpkg.cmake ? it has cmake extension for me, and it was so for years, and he used .make . Is that cause why all that wizardry with variables is required?
fucking amazing. Thank you
Hey sorry..how can i create a makefile that includes the library that i have downloaded from vcpkg? Please help :)
Seems it wont work with static libraries.
I’m giving this a try soon when I get some free time, I hope it works and maybe then I can finally build something with C++. The dependency stuff has always driven me away from C++. Looking at Pip, npm, and nuget, the package and dependency management in C++ just seems like a complete joke.
on windows atleast
I love you
.\bootstrap-vcpkg.bat is not creating an exe file, how can it be countered ?
From the caption i was thinking c++ without all those pointer error... lol...
Like for the like god. Comment for the comment throne.
17:58
sickofthis
fuck2
fuckthisshit
He's one of us
yeah ahahahaah
what to do incase of Visio code?
Perez Maria Martinez William Garcia Daniel
After watching the video I wrote how I setup c builds on windows here gist.github.com/LiamSwarbrick/96bb3236f85a81761b0b9695107f295b I find using just a batch file that calls the compiler once to be very simple. and makes adding libs like raylib easy (even though its c it shouldn't be much different to c++, change gcc to g++ etc..)
This is awesome but I am worried about people having to install vcpkg just to compile my code
Hernandez Sharon Smith Timothy Johnson Scott
this support any git hub repository ?
You know... This is a good reason to replace cpp
YEEEEEAAAAAAAAAS, the time for Ada to shine has COME!
@@MiiDev69 a number of Languages claim to be direct successors, including D, and C#.
IMHO, C# is almost always a better choice (especially for large projects, or where SDLC is a consideration). But I understand it's not always an option.
@@BrainSlugs83 I figured that C# might end up being my application building go-to language till I picked up Rust. Performance is much more on par with C/C++, automatic memory deallocation without any hindrance of a garbage collector, all the modern memory protections, data race prevention, the list goes on... I don't even miss C#, to be honest.
Michael Jensen I love C#, it’s honestly an amazing language and I’ve been using it for the last couple of months on a project I was working on, but you also have to remember that it’s a higher level language that isn’t suitable to replace a lower level language like C++. In the project I was working on we relied heavily on struct bitfields when it came to storing data and reading data. There was no native support for bitfields in C# in any capacity, and we had to do a lot of Boolean arithmetic to simulate bitfields which I’ll admit made things a little slower.
@Codely That's never been true except for AAA studios. And it's starting to change.
I miss the DJGPP days.... so much easier
This looks much more complicated than just booting up an engine and start coding.
Nobody ever said it wasn't. You do get much more control tho.
It's says "easy" but i highly doubt it
In my opinion this tutorial is not for beginners. Also the amount of excess words destroys structure of the lesson.
Despite all, nice try.
I am getting the following error while running the this command: .\vcpkg.exe integrate install
.\vcpkg.exe : The term '.\vcpkg' is not recognized as the name of a cmdlet, function, script file, or operable program. Che
ck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ .\vcpkg integrate install
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (.\vcpkg.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException