Compiling in “Notepad++”


I got a little carried away using Borland 6 to learn C. Powerful program and all, but due to my age, the UI customization capabilities are at the level of a notebook (the same one). For example, you cannot change the default colors for a code style. So I decided to move, at least in terms of the editor.

I’m a fan of Notepad++ 🙂 I really love this editor. And so I decided to tie the compiler to it. Notepad ++ is suitable for learning, although of course it is impossible to conduct large projects in it. Of the benefits – a convenient console that is always on the screen, you do not need to call it; in general, compiling in pros is quite simple, as it turned out:

  1. The first thing you need to do is install the compiler; because Notepad++ is just a code editor, it doesn’t know how to compile. So if you also write in C, install, for example, MinGW or any other compiler. You can bind an already installed one, for example, I tied my Borland (by the way, here is a link to the official free version of Borland C ++ Compiler 5.5). 
  2. If you have a compiler, now you need to install a plug-in for Notepad ++, which will allow you to run external applications and display them in the built-in console (very convenient!). The plugin is called NppExec. To install it, just go to the top menu of Notepad ++:
    Plugins → Plugin Admin → enter NppExec in the search bar and install it.
  3. Now go to Plugins → NppExec → Execute (well, or you can just press F6) and add there:
    npp_save
    cd $(CURRENT_DIRECTORY)
    C:\Program Files (x86)\Borland\CBuilder6\Bin\BCC32.exe "$(FILE_NAME)"
    cmd /c "$(CURRENT_DIRECTORY)\1.exe"
    The path “C:\Program Files (x86)\Borland\CBuilder6\Bin\BCC32.exe” should be changed to the path to your compiler, for example, it could be “C:\Program Files (x86)\Dev-Cpp\MinGW64\ bin\g++.exe”
    We save it all (below the “Save …” button).
  4. Next, go to Plugins → NppExec → Advance Options
    Bottom left button “Associated script”, there we select the name with which we saved the setting in the previous paragraph and click Add / Modify. Click Ok and reload Notepad++ (I’ll use the ‘NPP’ abbreviation in the future).
  5. Now, for convenience, we will put down a hotkey to run this script. We go:
    Settings → Shortcut Mapper → Plugin commands
    We assign a button from below. It is convenient to assign F1, which in NPP is not used for anything other than calling the About window 😉
  6. That’s it, we write our hallowworld and run it in the console!

By the way, about the console. My eyes hurt from the white console personally. If you are not a fan either: Plugins → NppExec → Advance Options there are settings for its colors. I made myself a black classic:

TextColorNormal: FF FF FF
TextColorError: FF 10 10
TextColorMessage 20 FB 20
BackgroundColor 00 00 00

Next, to color the console output, press shift+F6 → Hightlight and specify there, for example:
*Error* /// Red: 0xC1 /// Green: 0x22 /// Blue: 0x83

Happy to see your comments!


This entry was posted in C language (en), IDE (en), Notepad++ (en). Bookmark the permalink.

Leave a Reply

🇬🇧 Attention! Comments with URLs/email are not allowed.
🇷🇺 Комментарии со ссылками/email удаляются автоматически.