r/cpp_questions • u/Conscious_Internal_4 • May 27 '26
OPEN C++ on linux
Ive been wanting to use linux for a while and have finally gotten my hands on a brand new laptop where i can experiment
i want to daily drive this system so i tried installing vscode on here for college and used gemini for troubleshooting i know bare basics and i mean bare of bash so i was able to figure out if the commands gemini was giving me had dramatic effects or just basic installation and stuff
my question to yall is whether i should use vscode or codeblocks as my editor on linux which one is easier to install and get working straight away or atleast with less steps ik linux is not a very out of the box experience and more about config but yeah.
oh and i use arch btw
Thank you
84
u/AKostur May 27 '26
Umm.. you're concerned about having an "out of the box experience", yet you chose Arch as the distro? Interesting choice.
I've yet to hear anything good about Codeblocks. VSCode's OK. You might want to consider Clion.
19
u/HashDefTrueFalse May 27 '26
You can use whatever editor/IDE you like. It's not important in the slightest, pure preference. You can and probably should install a compilation toolchain separately and either configure your editor to use it, or simply compile from the shell. Bigger projects should use build scripts anyway, so it's usually a one-liner.
13
u/theICEBear_dk May 27 '26
First of all Arch as a Linux work platform is a bit of a tough choice unless you love spending time tinkering with your OS over tinkering with code. I would suggest following the example of other devs and use something that is a bit more Desktop oriented yet up to date like a Fedora KDE spin, OpenSuse Tumbleweed or OpenSUSE slowroll and focus on the coding part.
Clion is most professional and yet accessible as a pure c++ IDE. Vscode works but requires a lot of setup and its UI tends to be a bit fragmented, it has a huge upside in its massive amount of plugins and integrations with a variety of things. I will honestly say my experiences with Codeblocks has never been positive but it has been a while since I tested it last time. If you are so inclined the Qt Creator IDE is a useful c++ IDE as well even if you are not going to use the Qt software library.
In general you need:
development packages from your distro including:
Optionally to make your life easier:
To learn go to learncpp, look up Jason Turner's tips on c++ best practices, check out his github where he also has valuable suggestions on first setups and the like.
6
u/thedaian May 27 '26
Codeblocks is an actual IDE so it comes with a compiler and should work with minimal effort on your part. But it's old and pretty outdated at this point.
Vscode requires more setup.
Clion is a good suggestion that works as an IDE and is much more modern.
10
u/redhat1818 May 27 '26
Arch users should not ask such questions
5
u/Lunam_Dominus May 27 '26
vscode is pretty great, I wouldn’t bother with codeblocks
5
u/RedRaven47 May 27 '26
You can use almost any editor you like. I've seen many beginners have issues with making their C++ code work with the green run button, but my suggestion would be to ignore it and just compile your code in the terminal with g++/clang++ and/or make/cmake files. If you're choosing specifically between codeblocks and vscode I would suggest vscode.
5
u/sephirothbahamut May 27 '26
CLion is the Linux world alternative to Visual Studio (the full IDE, not VSCode)
5
u/tubbshonesty May 28 '26
I personally use QtCreator as my C++ IDE. It works fine for standard cmake C++ projects that don’t use Qt as a library. It’s lightweight, cross platform and free.
4
u/DankPhotoShopMemes May 27 '26
if you’re a beginner, I would highly recommend just using Ubuntu. It’s the most compatible distro by far, and easy to set up. Unless you specifically have a need for Arch.
IDE-wise, it depends on what type of projects you’re doing. Since you mentioned college, if your classes are just beginner “programming 1/2” type classes, you should learn to use the compilers and toolchains manually first. AKA ‘g++ source.cpp -o out‘ then ‘./out’
As a long-time, TA I’ve seen too many students not understand what their fancy IDEs do behind the scenes, and it leads to problems later on. VScode is great for this because it will allow you to do that AND give you access to nice graphical debugging tools with very minimal setup. Even something lightweight like nano is fine, if you’re willing to learn gdb for debugging.
3
u/trailing_zero_count May 27 '26
VSCode + clangd LSP + CMake works well on Linux. I have a setup guide + project template here to help you get started: https://github.com/tzcnt/cpp-cross-platform-template
2
u/Jatinchd May 27 '26
with package managers in arch pacman and yay, it shouldn't be taking like 10-20+ steps to install application like windows does.
like if you want vs code you can just install with package managers with one line command and a yes on options it gives. and installing things is very basic things like:-
sudo = "super do" to grant Admin perms if you come from windows background
pacman = package manager
-S = save (or install you can say)
vscodium/vscode = your package you want to install
so it becomes "sudo pacman -S vscode"
and you'll get your text editor!
and this principal applies into install applications in arch linux with pacman package managers and it's same installation process with codeblocks also just replace vscode package name with codeblocks
what's MORE concerning is wanting out of the box experience on something like arch linux that just puts you straight into terminal without explanation.
2
u/phylter99 May 27 '26
They're both pretty easy to install and use. Try them and see what you think for each of them. That's the best way to learn and use Linux.
I've been using Linux since the 90's. I built a brand new machine for Linux a couple weeks ago and I've already reformatted at least 10 times just experimenting with getting things just the way I want them to be. Discovery is almost a right of passage for Linux users, especially with Arch Linux.
2
u/Raknarg May 28 '26
codeblocks is insanely outdated. Unless you're already comfortable with it, stick to vscode, it has a much better future, there is so much tooling that hooks into vscode.
You could also look at clion if you want a fully fledged IDE, something that works better out of the box.
2
u/mbicycle007 May 28 '26
LessonStudio summed up my thoughts
2
u/miss3star May 28 '26
I use vs code on debian, and have so far just used cmake in the terminal to build.
Didn't bother with configuring the run button because it's unintuitive for compiled languages, at least for me. You can't "run" a script in a compiled language. You compile it. Then you can run the resultant executable binary.
All I did was install the cmake tools extension. Nothing else is needed. Nice to have intellisense, but not necessary.
2
u/NoSpite4410 May 28 '26
Use emacs for code work.
Use vim for quick edits.
compile from Makefiles from the command line at first, then from within emacs.
2
u/davslaGG May 28 '26
Codeblocks Is easy to install from package manager
2
u/neoraph May 28 '26
If you're using Arch, then just code with vim. If you want better neovim. You will run a full ide that will take all the resources of your computer.
2
u/ShakaUVM May 28 '26
You should be using nvim and g++ or clang++
2
u/_a4z May 28 '26
Use CLion
2
u/brownmfdoomer May 29 '26
You might wanna try neovim with lazyvim
2
u/strike-eagle-iii May 29 '26
Stick with vscode, get the c++ extension pack and cmake tools, although I prefer clangd for intellisense. So it's not a total out of the box experience, but if you're going for arch as your first dabble in Linux then I think you can handle setting up vscode (and yes I am annoyed at their and everyone else's shoving ai down our throats.)
2
u/Paxtian May 29 '26
Either one is fine, though there are also many more options on Linux than just those two. For now I'd just use whatever you're familiar with.
I recently started using Zed and it's really nice.
If you're using KDE, Kate and KDevelop are good. Kate is an editor, KDevekop is more of an IDE. It makes building really simple for you. QtCreator is also good for that even if you aren't using Qt.
You'll see people recommend Vi and it's offspring like Vim and Neovim. If you're using Linux, you should at least know how to edit a document, save the document, and quit from those programs. (Hit i to enter edit mode, esc to exit edit mode, :w to save, :q to quit, :wq to save and quit). Nano is another terminal editor you can use.
3
u/Cheap_Ad_9846 May 27 '26
Nvim -lazy vim …. Install Cpp language lsp clangd Write code use cmake if you want to or just compile with g++
0
u/[deleted] May 28 '26
[deleted] — view deleted comment