Advertisement

Is Sublime Text a valid option for C++ development?

Started by September 26, 2017 11:19 PM
12 comments, last by hplus0603 7 years, 2 months ago

I use Sublime Text for most of my programming (C, C++ and D). I use Premake to manage the builds. I generally develop on Windows with MinGW and keep an MSYS 2 window open in the background. You can can configure Sublime to build from short-cut keys in the editor, but my fingers are so used to `alt-tab` followed by the up arrow once or twice for the command  I want (to generate a new makefile if I've added any new source modules, otherwise to build & run the program) that it's second nature to me now. That, and I don't like how the output looks inside Sublime when building from within it. Now and again, I'll generate a Visual Studio project to make sure it all still builds there.

So yes, it's a perfectly fine option for C and C++ programming if you don't mind working with the command line. I also like VS Code, especially its built-in terminal (`ctrl-~` to open/close). I would probably prefer it if it were as snappy as Sublime, now that there's little separating them feature-wise. And the fact that I actually paid for Sublime 2 and upgraded to 3 makes me feel somewhat compelled to put it to use :-)

I use Sublime for C++, Python, Lua (Love2D), HTML/CSS/JS, text files, scripts, etc.  On Windows and Mac.  Works fantastic for refactoring (quick macros, replace in files, etc).

Either build from command or configure it to run whatever build process (which also boils down to command line).  Depending on the project I use either approach.

It's lightweight so quick to start compared to Dev Studio and Xcode.  It's almost infinitely customizable.

The macro code view on the right is great for scrolling through large files.  The folder sidebar on the left makes browsing for files way faster than file.. open.

The downside is no debugger, no type aware name completion (it does look for symbols already existing in the same file which works 80% of the time).

I probably only use half of Sublime's total functionality, and I could probably do way more if I sat down and learned it all.  But what I know already makes me super productive in it.

If you want something free for Windows, also check out SciTE.  But on Mac it's $40+ for some odd reason which is too much for a small text editor.

Advertisement

There are two schools of thought on this:

- School A: The IDE should do everything (project management, code editing, debugging, etc) so you only stay in one GUI for the entire project lifecycle. Visual Studio (a great IDE) thinks like this. XCode (not as good an IDE) also thinks like this. Eclipse, Android Studio, and a bunch of others also follow this pattern. Sublime doesn't work very well in this world, not because of Sublime itself, but because the IDE isn't great at letting any outside tool in.

- School B: Each tool should do what it's good at. gcc, or clang, or cl, compile code. make, or nmake, or msbuild, (or ninja/sbt/cabal/scons/whatever) calls compilers to run builds. Vim, or emacs, or whatever you want, edits text. In this world, Sublime is totally fine. Call this "command line development" for lack of a better term.

There's also the question of how you generate your project files (for IDEs) or make/build files (for command line.) Tools like cmake, premake, automake, and so forth, take it upon themselves to scan through your source code and generate the necessary make/project files for whatever your target development environment is. When you need to develop for many environments, this may add value. When you're just doing a single environment, building a simple make file yourself is quite likely to be simpler.

 

enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement