C++ programming without using visual studio 3: Notepad++

Musaddiq Al Ali (Ph.D.)
4 min readNov 15, 2020

C++ programming is needed for Engineers due to C++ fast compilation and compatibility with many IoT platforms. Even though, computer’s hardware and storage are getting larger day by day; many notebook makers nowadays solder the fast storage module “SSD” on board as well as RAM module. This makes post-purchase storage upgrading is impossible and also, triple the price of SSD upgrading choice when notebook buying. Many programmers I know chose instead of large storage, a bigger “on board soldered” RAM. Installing visual studio will take from roughly from 2 to 30 GB of the SSD area, which is inconvenient for the limited SSD capacity ,Therefore, I am sharing ways of build C++ programming environment with less installing storage as possible.

Install C++ compiler and Set the environment

Here we will introduce MinGW-w64 as C++. Installing the compiler was introduced in a previous article .

Notepad++

Notepad++ is a free editor running in the Windows OS. It easy to use and has many delightful functions. You can downloads notepad++ from here.

Configuration

Open the Plugin Manager.

Plugins > Plugin Manger > Show Plugin Manager

search for NppExec plugin in the list and install it by check the box then press the Install button.

Open the NppExec Execute dialog.

NppExec > Execute...

Copy and paste the following script into the Commands box.

SET G++ ="..cygwin path"\bin\g++.exe
NPP_SAVE // save current file
cd $(CURRENT_DIRECTORY) // go to directory of the current file
"$(G++)" -Wall -Wextra -Wpedantic -std=c++11 -o "$(NAME_PART)" "$(FILE_NAME)"

Note that, you need to replace “..cygwin path” with actual cygwin installation path on your computer. Save the script with any name. Here we chosen: Compile C++. Press Save button.

Now to make run directory we select empty script as shown below

Copy and paste the following script into the Commands box with replacing “..cygwin path” with the actual installation path of cygwin.

SET G++ = "..cygwin path" \bin\g++.exe
NPP_SAVE // save current file
cd $(CURRENT_DIRECTORY) // go to directory of the current file
"$(G++)" -Wall -Wextra -Wpedantic -std=c++11 -o "$(NAME_PART)" "$(FILE_NAME)"
if $(EXITCODE) != 0 goto Done
NPP_RUN cmd /C "$(NAME_PART)" && pause
:Done

Save the script with a name as you like. Here we used :Run C++.

Press Save button close the Execute dialog.

Again Open the NppExec Advance Options dialog.

NppExec > Advance Options...

From Menu item section, type in the name Compile C++ and select the Associated script “ Compile C++” .

Press the Add/Modify button to create a menu item.

Again, from Menu item section, type in the name Run C++ and select it from “Associated script”

Make Compiling Keyboard Shortcut

Press the Add/Modify button to create a menu item. Open the Shortcut Mapper.

Settings > Shortcut Mapper

Select the Plugin commands tab as shown below

Scroll down until you find the script names created above and click on its raw.

  1. Press the Modify button to open the Shortcut dialog and set the shortcuts for the scripts . Here we selected
  • alt+Shift+x

Now save the following program using in Notepad++ as .cpp

#include <iostream>
using namespace std;
int main()
{
cout << "Hello C++ World!" << endl;
return 0;
}

and ( press atl+shift+x ) . You will get the following results:

This is the end of “ C++ programming without using visual studio” series. In the following articles, we will discuss C++ programming itself.

--

--

Musaddiq Al Ali (Ph.D.)
0 Followers

Specialized in structural optimization and laser physics