Skip to main content
GameDev.net gamedev.net
🔒 Locked

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

Started by SweetestDownfall Sep 26, 2017 at 11:19 PM 12 replies 13.3k views
Original Post
SweetestDownfall
SweetestDownfall

Hi!
So, I really like Sublime, I like its design and its simplicity. My question is, is it a valid option to use Sublime for C++ OpenGL 2D game development?

jpetrie
jpetrie

It's just a text editor. So you can't just use Sublime Text; you'll need a compiler at the bare minimum and you'll likely want a mechanism to organize your build (be it makefiles or something more complex) and probably a debugger as well.

But as far as the text-editing aspects of making games? Absolutely.

SweetestDownfall
SweetestDownfall
1 minute ago, jpetrie said:

It's just a text editor. So you can't just use Sublime Text; you'll need a compiler at the bare minimum and you'll likely want a mechanism to organize your build (be it makefiles or something more complex) and probably a debugger as well.

But as far as the text-editing aspects of making games? Absolutely.

This might sound silly, but can't I just compile and stuff through terminal or something?

Nypyren
Nypyren
9 minutes ago, SweetestDownfall said:

This might sound silly, but can't I just compile and stuff through terminal or something?

Yeah, all the tools people use are eventually just running the compiler one way or another. You can do it via a makefile, or actually invoking the compiler executable by hand if you want.

jpetrie
jpetrie
30 minutes ago, SweetestDownfall said:

This might sound silly, but can't I just compile and stuff through terminal or something?

Yes, you can certainly invoke your compiler manually from a command-line interface if you want.

Servant of the Lord
Servant of the Lord
41 minutes ago, SweetestDownfall said:

This might sound silly, but can't I just compile and stuff through terminal or something?

In theory, yes, but for anything other than tiny projects, you don't want to have to manually pass all 100+ filepaths to the terminal for your .cpp files, and don't forget proper library linking order, compiler settings, and in some cases conditionally including or excluding files based off of platform you are building the project for.

This is what makefiles are for. But makefiles are terrible to write and maintain, so people use other intermediary formats that are more human-friendly to use, that then get converted to the makefiles that then generate calls to the compiler. CMake is very popular, though I use QMake for my own projects (mostly because I use QtCreator as my IDE - but I also like the QMake system on its own). Boost has its own, and Visual Studio uses their own without using the GCC makefiles.

So yes, Sublime is fine for programming as your IDE, but you'll still want CMake or similar, for your "project" file (which is a plaintext file you can edit from within Sublime), and you'll still need a compiler (MinGW or Clang, for example) to actually do the compiling.


Sublime also costs money, so if you don't want to pay, Programmer's Notepad 2 is free and fairly nice. It might not be as slick as Sublime, but it certainly works well-enough, so you might want to give that a try and see if it suits your needs before deciding to go with Sublime.

_Silence_
_Silence_

I personally did not liked Sublime Text. All what it provides are flashy things not really useful for programming.

As other posters told about alternatives, other editors like geany for example are very good. Geany is also a tiny IDE in the sense that it allows you to build and run your project from within the editor. I personally use it for little projects, editing some shaders or doing little websites.

To go back to the original question, yes you can do it. For a long I was living with vim (and/or gvim) and a console (threw automake makefiles). But as projects grew up, and as entering new projects, IDEs revealed to be a great help (you know you can click on a function and jump to its definition/declaration, you can hoover a variable and see its type, you can push ctrl-space and have completion to work). This saves time, and saves efforts, and saves frustration. This is really important to my opinion.

Shaarigan
Shaarigan

Also bear in mind that well known IDE's support advanced debug features like setting breakpoints into your code while running, disassembling code if needed and also integrate code versioning by default (even if I not use the build in ones but one might do so)

ongamex92
ongamex92

As said above, easy debugging is the feature that you want to go after. Especially when you are learning. Being able to break the program, see the current state is the No.1 tool that will shorten the learning curve the most. That's why I recommend Visual Studio Community Edition, it has the best debugger integration.

And do not worry about not learning how to call the compiler/linker manually, it is a trivial thing, and when you need if you need it you can always look it up, it's not a big deal.

So again, go after the debugger.

dietrich
dietrich

I use Sublime for hobby projects (C-style C++ and shaders mostly) and I find it much more comfortable, fluid and frustration-free than Visual Studio's built-in text editor, that I use at work. For me it was enough to justify having to set up command-line compilation.

6 hours ago, ongamex92 said:

As said above, easy debugging is the feature that you want to go after.

Agree 100%, but using an external text editor doesn't really prevent one from debugging in VS - so why not enjoy the benefits of both? One can always edit code in Sublime, compile and Alt-Tab into Visual Studio to do some debugging.


Aldacron
Aldacron

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 :-)

nullterm
nullterm

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.

hplus0603
hplus0603

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 };

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.