How to compile and run C files from within Notepad++ using NppExec plugin?

Here’s a procedure for Perl, just adapt it for C. Hope it helps.

  • Open Notepad++
  • Type F6 to open the execute window
  • Write the following commands:
  • npp_save ← Saves the current document
  • CD $(CURRENT_DIRECTORY) ← Moves to the current directory
  • perl.exe -c -w "$(FILE_NAME)" ← executes the command perl.exe -c -w , example: perl.exe -c -w (-c = compile -w = warnings)
  • Click on Save
  • Type a name to save the script (e.g. “Perl Compile”)
  • Go to Menu PluginsNppexecadvanced optionsMenu Item (Note: this is right BELOW ‘Menu Items *’)
  • In the combobox titled ‘Associated Script’ select the script recently created in its dropdown menu, select Add/Modify and click OKOK
  • Restart Notepad++
  • Go to Settings → Shortcut mapper → Plugins → search for the script name
  • Select the shortcut to use (ie Ctrl + 1), click OK
  • Verify that you can now run the script created with the shortcut selected.

Leave a Comment