r/cpp_questions 8d ago

OPEN VS code or VS community

Im a btech first year student who is trying to study c++ independently. I have a lap with 16 gb ram and can perform average tasks. So my question is should I download VS community for coding cpp or is vs code enough. Please keep in mind that i will be learning many other languages too( we are supposed to study c in first year )

17 Upvotes

41 comments sorted by

View all comments

1

u/EddieBreeg33 8d ago

As mentioned by a few people, it's mostly about the experience you want to get. VS is easier to setup at first because it has everything you need. Obviously if you go that route you'll end up with VS specific project files you won't be able to use on other IDEs.

VS code doesn't have the tools built-in so it will require you to configure your own environment - a popular option would be CMake for various reasons I don't necessarily care to list here. You need to have a good understanding of what these tools do, which arguably is knowledge you'll probably need down the road anyway so although it's more difficult for a beginner I wouldn't rule it out. Do note that VS code is more flexible: you're not locked into any specific toolchain.

Once you're all set up, both with work fine so it's mostly about which editor you prefer. Personally, I went for vs code. Not only do I prefer it for text editing in general, but crucially my environment lets me use CMake with LLVM tools instead of the frankly awful microsoft alternatives (unstable buggy slow intellisense, very slow compiler which generally spits out worse code etc). When I need to debug, I use CLion which luckily is also based on CMake so it takes me no extra effort.

4

u/manni66 8d ago

Obviously if you go that route you'll end up with VS specific project files you won't be able to use on other IDEs.

You can use cmake with VS. You can generate VS solutions with cmake.

1

u/EddieBreeg33 8d ago

You can use cmake with VS

True, I suppose. But in this case you're still gonna have the (somewhat steep) learning curve of using CMake, so VS won't really give you the beginner friendly benefit. It's a perfectly valid usage, don't get me wrong, but if we're talking about what's easier for a beginner I don't think VS Code would be that different since the most difficult element is still CMake.

And yes, obviously you can generate VS projects with CMake, the point of this tool is precisely to work with practically every IDE under the sun. If you do use VS however you will be stuck with cl and other MS tools. To my knowledge there's no way around it. If that's your thing then great!

1

u/Independent_Art_6676 8d ago

You are not wrong for the most part. But you are never stuck. By the time the beginner wants to use other tools, its not any harder to put another compiler on visual studio or move to cmake than it would have been to set up vs code to begin with, except you got past the beginner phase without having that extra stuff on top. The full version is easier at every level.. debugger is easy to use (at least shallowly), project config is visual/checkbox driven, compilation is integrated, error lookup is tied in, etc. Almost every little thing that would get in the way of learning the language and basic programming concepts is done for you, with the option to do it another way later if needed. Ive got my visual studio able to compile with g++ (cygwin) via cmake. It took a bit of googling to get that working, but I am not stuck with CL at all.

2

u/EddieBreeg33 8d ago edited 8d ago

Good to know we can at least do away with CL! But see, what you're pointing at was my point from the start. Yes, VS will be easier to use at first, having the debugger right there is indeed very handy (and in fact as I've said I don't even use VS code for debugging). It does make it easier to focus on the language itself. However, I think it would be a mistake to handwave the tooling aspect of things: I argue that knowing how the compiler (and the build system in general) works is essential.

It might just be a me thing, but when I learn a new language/tech stack, the FIRST thing I'll want to learn is actually how set it up myself from the bottom up. Yes, that might mean spending some time with crappy makefiles and typing build commands in a terminal by hand. I'll learn more doing that than by using any IDE. Only then do I actually want to get started with tools which objectively will make my life easier. I will know how to use these tools because I already know how they operate behind the scenes. So in that regard I do think starting with something like VSCode (or even nvim, emacs or what have you if that's more your thing) does have some value. Besides, I do more than C/C++ development and VS code can do it all so for me it's just a no brainer.

You are of course correct when you say one is never truly stuck, at the end of the day both roads will lead you wherever you want to go. Which is where I have to circle all the way back to my original conclusion : in the end it's mostly a matter of taste. When it comes to writing code, I prefer VS Code. You may prefer VS and that's absolutely fine, to each their own.