• Advertisement

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

Recommended Posts

Advertisement

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.

Share this post


Link to post
Share on other sites
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?

Edited by SweetestDownfall

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Edited by _Silence_

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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.

Edited by ongamex92

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Advertisement
  • Advertisement
  • Popular Tags

  • Advertisement
  • Popular Now

  • Similar Content

    • By Hawkblood
      I've been away for a VERY long time, so if this topic has already been discussed, I couldn't find it.
      I started using VS2017 recently and I keep getting warnings like this:
      1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d10.h(609): warning C4005: 'D3D10_ERROR_FILE_NOT_FOUND': macro redefinition (compiling source file test.cpp) 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\shared\winerror.h(54103): note: see previous definition of 'D3D10_ERROR_FILE_NOT_FOUND' (compiling source file test.cpp) It pops up for various things, but the reasons are all the same. Something is already defined.....
      I have DXSDK June2010 and referencing the .lib and .h set correctly (otherwise I wouldn't get this, I'd get errors)
      Is there a way to correct this issue or do I just have to live with it?
       
      Also (a little off-topic) the compiler doesn't like to compile my code if I make very small changes.... What's up with that? Can I change it? Google is no help.
    • By lonewolff
      Hi guys,
      I am having problems with trying to perform a basic 'shift left' on a char.
      char temp[1]; temp[0] = buffer[0] << 1; // buffer[0] is 0xff After this I have temp[0] writing to a file. Instead of being the expected 0x7F it is written as 0xF8.
      Any guidance on what I am doing wrong would be awesome.
      Thanks in advance
    • By sergio2k18
      Hi all
      this is my first post on this forum.
      First of all i want to say you that i've searched many posts on this forum about this specific argument, without success, so i write another one....
      Im a beginner.
      I want use GPU geometry clipmaps algorithm to visualize virtual inifinte terrains. 
      I already tried to use vertex texture fetch with a single sampler2D with success.
       
      Readed many papers about the argument and all speak about the fact that EVERY level of a geometry clipmap, has its own texture. What means this exactly? i have to 
      upload on graphic card a sampler2DArray?
      With a single sampler2D is conceptually simple. Creating a vbo and ibo on cpu (the vbo contains only the positions on X-Z plane, not the heights)
      and upload on GPU the texture containing the elevations. In vertex shader i sample, for every vertex, the relative height to te uv coordinate.
      But i can't imagine how can i reproduce various 2d footprint for every level of the clipmap. The only way i can imagine is follow:
      Upload the finer texture on GPU (entire heightmap). Create on CPU, and for each level of clipmap, the 2D footprints of entire clipmap.
      So in CPU i create all clipmap levels in terms of X-Z plane. In vertex shader sampling these values is simple using vertex texture fetch.
      So, how can i to sample a sampler2DArray in vertex shader, instead of upload a sampler2D of entire clipmap?
       
       
      Sorry for my VERY bad english, i hope i have been clear.
       
    • By mangine
      Hello. I am developing a civ 6 clone set in space and I have a few issues. I am using Lua for the logic and UI of the game and c++ directx 12 for the graphics. I need a way to send information between Lua and c++ occasionally and was wondering what is the best and most flexible (and hopefully fast) way to do this. Don't forget that I also need to send things from c++ back to Lua. I know of a lua extension called "LuaBridge" on github but it is a little old and I am worried that it will not work with directx 12. Has anybody done something similar and knows a good method of sending data back and forth? I am aware that Lua is used more and more in the industry and surely plenty of AAA game programmers know the answer to this. I want a good solution that will hopefully still be viable code in a couple of years...
  • Advertisement