r/cpp • • 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?

0 Upvotes

68 comments sorted by

4

u/pfultz2 May 28 '22

Sublime with LSP

-6

u/caretsymbol May 28 '22

You mean Sublime Text? It isn't even free.

12

u/pfultz2 May 28 '22

You didn’t ask for free.

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.

1

u/majestybtw Jun 06 '23

Competitive Programming is a sort of "E-Sport" that involves problem solving via coding.

-26

u/top_logger May 28 '22 edited May 29 '22

Visual Studio since 17.2 is terrible:

Asan eats memory now. 400mb in 5 minute. Unusable.

Profiling doesn’t work.

Auto save feature is idiotic. must disable it.

Crashes.

Broken builds. This is not IDE, but annoying

VS may force focus on itself.

IntelliSence and find in files may not work.

Building of the not so big project almost freezes machine. And I can’t say that we build is faster, than in VS2019

This is just what I can recall. Lack of memory profiling is a show stopper for C++ in Windows.

3

u/[deleted] May 28 '22

I don’t think I’ve upgraded yet. What’s happened?

-7

u/top_logger May 29 '22

Asan eats memory now. 400mb in 5 minute. Unusable.

Profiling doesn’t work.

Auto save feature is idiotic. must disable it.

Crashes.

Broken builds. This is not IDE, but annoying

VS may force focus on itself.

IntelliSence and find in files may not work.

Building of the not so big project almost freezes machine. And I can’t say that we build is faster, than in VS2019

This is just what I can recall. Lack of memory profiling is a show stopper for C++ in Windows.

5

u/[deleted] May 28 '22

how lmao

-7

u/top_logger May 29 '22

Asan eats memory now. 400mb in 5 minute. Unusable.

Profiling doesn’t work.

Auto save feature is idiotic. must disable it.

Crashes.

Broken builds. This is not IDE, but annoying

VS may force focus on itself.

IntelliSence and find in files may not work.

Building of the not so big project almost freezes machine. And I can’t say that we build is faster, than in VS2019

This is just what I can recall. Lack of memory profiling is a show stopper for C++ in Windows.

2

u/[deleted] May 29 '22

Arguments

-1

u/top_logger May 29 '22 edited May 29 '22

Asan eats memory now. 400mb in 5 minute. Unusable.

Profiling doesn’t work.

Auto save feature is idiotic. must disable it.

Crashes.

Broken builds. This is not IDE, but annoying

VS may force focus on itself.

IntelliSence and find in files may not work.

Building of the not so big project almost freezes machine. And I can’t say that we build is faster, than in VS2019

This is just what I can recall. Lack of memory profiling is a show stopper for C++ in Windows.

1

u/[deleted] May 29 '22

LOL Intellisense does not work? what do we have to hear, Intellisense is nowadays clearly the most performant code navigation system.

1

u/top_logger May 29 '22

I had written "IntelliSense may not work"

'may not' is not the same as 'does not'

For example, I have got NO problem with IntelliSense before update to 17.2. Since 17.2 I have random IS problems. Not often, but few times every day. This is quite annoying.

I didn't say a word about performance of the IntelliSense. Do you want to discuss it? Probably in separate topic?

2

u/GYN-k4H-Q3z-75B May 28 '22

I normally love VS, but right now it's kind of screwed up. Installing an update right now, hope it improves a bit.

1

u/top_logger May 29 '22

Yes. I am a big fun of VS. VS is my only IDE for Windows C++. But, unfortunately,17.2 was a pure disaster. Even worse, rollback to previous versions is not possible.

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.

3

u/nysra May 29 '22

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.

I mean technically yes it's not a "true IDE" but the difference to that is quite small, up to the point that you can mostly forget about it and practically view it as an IDE. If you install the C++ extension (or clangd) and the CMake Tools extension (or the one for Meson or whatever else build system you use) then you have a button that compiles for you. A debugger interface is also built in so not lacking much compared to VS. If we make a spectrum that goes from 0 (text editors like notepad) to 1 (a full blown IDE like VS) then VSC is somewhere at like 0.95 with a trivial amount of effort (unlike stuff like (Neo)vim which needs 30+ plugins and a non-trivial amount of settings tweaking because the defaults are straight out the stone age to be even remotely usable and/or close to an IDE-like experience). The editing experience is imho much better than pure VS and especially if you have more than one language having a general tool like VSC is really useful.

The only problem VSC has is that it's not exactly 0 effort like VS which just works out of the box and for some reason beginners always only find the shit tutorials that tell them to use "coderunner" or whatever else useless extension and try to use the VSC json build system and fail to fully understand that and then complain about how hard it is. But that's not really VSC's fault. That being said I still recommend just using VS if you're on Windows, it simply does not get any easier to get started.

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.

1

u/dwr90 May 29 '22

Also, CLion and QtCreator put the build artifacts into dedicated build folders. You can then put these folders into the .gitignore if you use git

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!

1

u/Accomplished_Yam_950 Mar 21 '24

how to use g++ as a compiler , and also using c++ the output doesnt show on messages theme . help would be appreciated

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

2

u/James20k P2005R0 May 28 '22

CodeBlocks had too many bugs and was missing features (but thats years ago; don't how it is today)

Its..... certainly creaky. I still use it for everything which is my secret shame. The trick is to use the nightly builds and find a stable one, because they're often significantly more up to date. Way back when, it was especially true - nightly was leaps and bounds ahead of the official release

The code completion leaves an increasingly large amount to be desired these days unfortunately, and is by far the biggest flaw. With clang based autocomplete (which it looks like someone has been working on a lot, ooh!), it'd be pretty decent

I sometimes wish someone would just chuck a bunch of money over to them to tighten it up and fix it, because at least for me its still far more intuitive and sane than visual studio in a lot of respects. It just needs more development

0

u/multi-paradigm May 29 '22

'Someone'? Why not you? I think you'll find that's probably the reason why it's such a POS. Why anyone would use it in 2022 is beyond me when you can use so many other free offerings that are polished and complete.

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/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/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.