While really it doesn't make sense to do it this way (use a proper IDE like eclipse), it is possible using NppExec. Note that many IDEs allow you to set up an external text editor if you prefer to use Notepad++, while still allowing you to use the IDEs integrated toolchains for building/testing.
You basically set up a script to run to do the compiling and NppExec will execute the commands - including calls to external programs like cmd.exe
.
This is what I've used in the past to quickly test code using gcc
that was installed as part of Cygwin (needs to be on the system path in this example), but you can modify it for other compiler paths:
cls
echo Deleting old version of: $(NAME_PART).exe (If Exists)...
cmd /c del "$(CURRENT_DIRECTORY)\$(NAME_PART).exe"
echo Saving Notepad++ File ($(FULL_CURRENT_PATH))...
NPP_SAVE
echo
INPUTBOX "GCC Compiler Switches. Add switches here, or press enter to use default. Output file will be $(NAME_PART).exe":
echo Compiling Program...
cmd /c "gcc -std=gnu99 "$(FULL_CURRENT_PATH)" -o "$(CURRENT_DIRECTORY)\$(NAME_PART).exe" $(INPUT)"
echo $(OUTPUT)
echo Exit Status: $(EXITCODE)
You can modify it to suit your needs. Basically it starts by deleting any .exe with the same name and in the same directory as the current file (this is the file that GCC will be instructed to output once compiled). You can skip this if preferred.
Then it saves the current file open in Notepad++.
Next it displays an dialog message to enter any additional switches for GCC.
It then calls GCC to compile the current file and produce an .exe with the same name.