Install the latest version 6.4.2 of notepad ++, select "plug-in" -- "plugin manager" -- "show plugin manager", and select "nppexec" in available ", click Install.
Open a C program and use the F6 shortcut key to bring up the execute dialog box. Refer to the help document of notepad ++ and enter the command line in it:
//save current file
NPP_SAVE
// run@.cpp
SET gcc = C:\MinGW\bin\gcc.exe
SET obj = $(CURRENT_DIRECTORY)$(NAME_PART)
"$(gcc)" -c "$(FULL_CURRENT_PATH)" -o "$(obj).o"
"$(gcc)" "$(obj).o" -o "$(obj).exe"
npp_run "$(obj).exe"
UNSET obj
UNSET gcc
Set GCC = "Your mingw installation directory", and add a mingw system variable "C: \ mngw \ bin" to the system environment variable path. otherwise, a DLL missing error is reported, and the C program can be compiled correctly. If you want to compile the C ++ program, replace GCC with G ++.
Ultimate Edition:
//clear screen
cls
//save current file
NPP_SAVE
// compile
SET gcc = D:\MinGW\bin\gcc.exe
SET obj = $(CURRENT_DIRECTORY)\$(NAME_PART)
cmd /c if exist "$(obj).exe" del "$(obj).exe"
"$(gcc)" -c "$(FULL_CURRENT_PATH)" -o "$(obj).o"
cmd /c if exist "$(obj).o" "$(gcc)" "$(obj).o" -o "$(obj).exe"
//run
//npp_run "$(obj).exe"
cmd /c if exist "$(obj).o" del "$(obj).o"
cmd /c if exist "$(obj).exe" "$(obj).exe"
UNSET obj
UNSET gcc