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

前端 未结 10 1440
北荒
北荒 2020-11-30 00:45

How can I configure the NppExec plugin for Notepad++?

I would like NppExec to compile my C files, run them, and show their output, all within Notepad++.

10条回答
  •  天命终不由人
    2020-11-30 01:09

    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 test.pl (-c = compile -w = warnings)
    • Click on Save
    • Type a name to save the script (e.g. "Perl Compile")
    • Go to Menu Plugins -> Nppexec -> advanced options -> Menu 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 OK -> OK
    • 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.

提交回复
热议问题