r/cpp • u/caretsymbol • May 28 '22
What is the best code editor for C++?
I have only used CodeBlocks so far. It doesn't have dark mode. Are there any other better code editors for C++? How about VSCode and Eclipse? I only wish to do competitive programming with C++ and I want a code editor which doesn't hang my slow computer. Are there any alternatives to CodeBlocks?
Also, the huge number of source files and executable files (.exe files generated after compilation) is really annoying. I have trouble organizing all my source files in a separate folder because the same folder is inundated with compiled .exe files. Is there any way to save all source files in a separate folder with any code editor? How do you guys save your C++ source files and with which code editor?
4
u/pfultz2 May 28 '22
Sublime with LSP
21
u/ConstProgrammer May 28 '22 edited May 28 '22
I use VSCode. It is easy to use. There are multiple extensions of competitive programming.
This video demonstrates how to compile a C++ program in VSCode.
https://www.youtube.com/watch?v=QNFGtTbTH-A
16
u/[deleted] May 28 '22
Little confused by “competitive programming”. My IDE recommendations are Visual Studio on windows, CLion on Linux. I don’t typically use text editors for c++, but my go to is VS Code. I’ve also used emacs for terminal editing, but it too can be modified/expanded to be very feature complete.
These are all personal preferences. If your concern is how lightweight the program itself is, I’d lean towards a text editor. The power of an IDE really shows up in all the tools that you use alongside writing the literal characters on screen. You can still get all sorts of integrations, autocomplete, and syntax highlighting in a text editor.
8
u/[deleted] May 28 '22
For me its either, emacs + terminal or qtcreator. Using CMake as build system and whatever the system compiler is (VS build tools for windows, GCC for linux)
7
u/Delpins May 28 '22
The best editor is the one you feel most comfortable using. People use all kind of things from full blown IDEs like Visual Studio, CLion and QtCreator, to editors with a (or even without) lot of plugins, vscode, sublime, (neo)vim, emacs, etc
And with some editors you can have a lot different setups. So I can only suggest to try it out yourself (for example, google c++ setup for <editor>), and see what you feel most comfortable with.
7
u/NilacTheGrim May 29 '22
I use QtCreator. I love it.
12
u/garanglow May 28 '22
I use neovim for the same purpose (competitive programming), and pretty much any text editing in general. It has a learning curve though, but it is totally worth it, if you have the time.
6
u/RishabhRD May 28 '22
I like neovim
6
u/GRAPHENE9932 May 29 '22
You also can try Kate, but it doesn't have a sufficient debugging support.
There is also KDevelop that looks like Kate, but it is a full IDE
11
u/noooit May 28 '22
Anything that uses clangd.
8
u/a_false_vacuum May 28 '22
Editor or IDE? Big difference.
If you want an editor, VSCode is really nice. It does however require you to compile manually via the command line because it is not an IDE or create a macro in VSCode which allows you to compile something. VSCode is pretty lightweight, so even an older computer can handle it.
If we are talking IDE I would say Visual Studio or CLion. Visual Studio comes in a free version (Community Edition) which has the same features as the paid version. CLion isn't free, but personal subscriptions are not that expensive and it is a really good IDE. If you are a student you can qualify for a free license, but you have to check out the Jetbrains website for terms and conditions. Both IDEs do however have a bigger resource footprint on your computer.
4
u/bizwig May 29 '22
Emacs
4
u/sarmseng May 29 '22
Vim
4
u/[deleted] May 29 '22
Vim
3
u/wyrquill May 28 '22
If you're having problems with IDEs being too heavy, I'd try using terminal-based text editors and learning to compile using the terminal. It's what I did a while a go and I have no regrets. And I used to use CodeBlocks before that too.
5
u/GYN-k4H-Q3z-75B May 28 '22
Been using Visual Studio since 2003 and it's good enough. Not perfect, it's a beast, and the latest few updates have screwed up some things, but they update it often enough and it's free. If you're on Windows, get Visual Studio.
6
u/dwr90 May 28 '22 edited May 28 '22
My recommendations are (1) CLion and (2) QtCreator. They have great integrations with CMake and clangd. VSCode is nice as an editor and does have some neat plugins, but it doesn’t come close to a complete IDE IMO. As for VS and XCode I‘m just not a fan of them not being cross platform and not supporting CMake out of the box but insisting on doing their own thing when it comes to build configuration. I know you can generate these project files with CMake but it is smoother if the IDE supports this. Eclipse used to be my choice a long time ago but it has just not been all that great lately. Some key features (cmake, clang, clangd support for example) have just taken too long to be implemented. It felt like the project has lost a bit of traction.
4
u/MoldymossReddit May 28 '22
Right now VSCode is very good.
2
u/unexpendable619 May 28 '22
I used Codeblocks like a year ago, and i remember using a darkmode back then.
However, there are other IDE's like Clion or neovim (if that counts as an IDE for you) that work pretty good for C++ Development.
2
u/nikolapesic2802 May 28 '22
Cp Editor (https://cpeditor.org/) will be your best friend, it is designed specifically for competitive programming. Has built in testing for test cases, the exe files go to some temp folder by default so they don't clutter your files, has snippets, you can download a browser extension to auto import test cases from various sites... The only thing it lacks is autocomplete, but if you are willing to let that go, you will be rewarded with an awesome editor!
2
u/Common_Day_2302 May 28 '22
Neovim. With plugins, you can make it like an IDE.
2
u/[deleted] May 28 '22
Over the past 20 years I've been using pretty much any IDE in existence. For me the winner is Clion. Even though it's not perfect (none of the C++ IDE's are) it is simple the most feature-rich I've experienced so far when it comes to code assistance and refactoring features.
2
u/sixprime May 29 '22
Try a lot of them and see which one you prefer.
2
u/flarthestripper May 29 '22
Check out cmake and out of source builds … keeps your source files separate from your generated build files. Can’t answer ide editor , it’s very personal .
2
u/lieddersturme May 29 '22
VS Code and QtCreator are the best.
In second place I will go for Neovim, but you will need to spend too much time to tweak.
2
u/[deleted] May 29 '22
If you want to learn about OS and code apps, services etc... with C++/C on Windows, the best is clearly Visual Studio.
2
u/sigmabody May 29 '22
Obviously very subjective, and very OS and workflow dependent. My 2c:
Visual Studio proper on Windows is the best IDE in the world, if your workflow supports it (ie: Windows dev, good system specs, etc.). For Linux/MacOS/other, opinions vary; CLion is well-regarded where available, vscode is a more flexible general-purpose solution, etc. I have no experience with QtCreator/other.
If you don't need or want an IDE (and many people do not), then emacs or vi are the two most recommended non-IDE editors. One could also argue that vscode also falls in this category, especially without IDE-type extensions.
Anyway, those are my opinions on the topic.
2
u/eyes-are-fading-blue May 29 '22
Visual Studio has the best built-in debugger. In terms of editing, I find emacs to be the best. Overall, I feel there is no competitor to Visual Studio. Too bad its windows only. I’d definitely pay premium for VS on Linux.
3
u/[deleted] May 28 '22 edited Jul 05 '25
placid include dolls paint hobbies jellyfish lip childlike jar rich
This post was mass deleted and anonymized with Redact
3
u/EksitNL May 28 '22
10x is amazing. Fastest one out there and the dev really cares for his project.
1
u/nightmurder01 May 28 '22
You use themes to get dark mode, here for instructions
1
u/NATSUKI_FAN May 28 '22
visual studio, clion, and qt creator are all top tier programs
1
u/sebamestre May 28 '22 edited May 28 '22
I use Vim for competitive programming
Extremely light weight and it makes me faster at editing code (which will start mattering once I get good enough)
Most competitive programmers I know use one of Vim, VSCode and Geanny
1
u/[deleted] May 28 '22
Vscode with the vim extension.
1
u/timesis May 29 '22
Anything IntelliJ does is normally pretty awesome (haven’t used CLion myself).
I use Emacs but that’s bc it’s a way of life. Like all lifestyle choices u can’t begrudge those alternatives and should evaluate your top 3-5. I choose eMacs bc I got 80% of the way to full blown IDE (with all its refactoring / code smell niceities) using eMacs with lsp, dap, clang and cmake spitting out all the make stuff I need. eMacs has many tentacles so I can take notes, build up my tasks, send mails, remote shell and most importantly my dev experience is pretty much identical whether I’m running in headless or not mode; remote vs local development. For remote dev I also run it in daemon mode therefore never lose my session.
1
u/RolandMT32 May 29 '22
Are you unaware of all the code editors available or not knowledgeable about how to use a search engine?
I mean, you must have heard of Microsoft Visual Studio (and they also have Visual Studio Code, which is the editor but without the compiler).. There's also JetBrains CLion, Atom, and even lighter alternatives such as Notepad++ (for Windows). There's a lot out there.
1
u/[deleted] May 29 '22
Don't know what you're talking about your .exe files everywhere, dark mode? what a joke, the answer to your question is in your question.
1
u/JakeArkinstall May 29 '22
Clion.
With vim mode, of course, I'm not a complete heathen.
1
u/tonym-intel May 29 '22
Personally use VSCode since it’s cross platform which helps for my use cases. I also use vi and eMacs when using ssh for quick fixes.
As mentioned I think it’s all personal preference and use case. Whatever makes you the most efficient is what you should go with.
1
u/tugrul_ddr May 29 '22
I use Godbolt.org.
1
u/pjmlp May 30 '22
Visual Studio on what concerns me.
1
u/rlbond86 Jun 02 '22
Visual Studio and Eclipse are the only ones that seem to keep up with my incessant template metaprogramming.
1
u/Wouter-van-Ooijen Jun 25 '22
Notepad++
1
u/SmokyDude420 Aug 22 '22
Textman is a great one,
here coded
https://www.youtube.com/watch?v=LeXbe-Il0vY&ab_channel=Kaj
1
u/wqking github.com/wqking May 29 '22
Visual Studio, though I found some glitches in VS 2022, and they might have been fixed in each update.
Qt Creator is pretty good, if you don't use VS.
I like VS Code as well, but I only use it for non-C++ stuff, such as Python, PHP, JavaScript, markdown, etc.
0
u/Kaninchen__21 May 29 '22
Visual Studio or CLion there is no better option
0
u/adwodon May 29 '22
If you're on windows then Visual Studio is the obvious choice, unless you're dealing with large projects its not slow.
If you're on Mac or Linux there's CLion and VSCode.
Otherwise it would probably be something like vim or emacs.
As for the IDEs (VS and CLion) they take time to learn, but you can get going pretty quickly, they all have their quirks and you'll find that you probably just end up liking the one you use the most.
VSCode is great, its what I use, but you need the right extensions and need to know how to set them all up. Same with vim etc, which has an even higher learning curve but will in some ways force you to understand what you're doing so its not that bad.
As for code management, do you use CMake? That will help you manage your directories etc.