0

I've been trying to run this:

npp_console 1               //open console
NPP_CONSOLE -               //disable output of commands
npe_console m-              //disable unnecessary output
con_colour bg= 191919 fg= F5F5F5    //set console colors
npp_save                //save the file
cd $(CURRENT_DIRECTORY)         //follow current directory
NPP_CONSOLE +               //enable output
IF $(EXT_PART)==.c GOTO C       //if .c file goto C label
IF $(EXT_PART)==.cpp GOTO CPP       //if .cpp file goto CPP label
IF $(EXT_PART)==.java GOTO JAVA     //if .java file goto JAVA label
IF $(EXT_PART)==.cs GOTO C#     //if .cs file goto C# label
IF $(EXT_PART)==.py GOTO PYTHON     //if .py file goto PYTHON label
echo FILE SAVED
GOTO EXITSCRIPT             // else treat it as a text file and goto EXITSCRIPT
//C label
:C                                                                  
cmd /C if exist "$(NAME_PART).exe" cmd /c del "$(NAME_PART).exe"//delete existing executable file if exists
gcc "$(FILE_NAME)" -o $(NAME_PART)              //compile file
IF $(EXITCODE) != 0 GOTO EXITSCRIPT             //if any compilation error then abort
echo C CODE COMPILED SUCCESSFULLY:              //print message on console
$(NAME_PART)                                            //run file in cmd, set color to green and pause cmd after output
GOTO EXITSCRIPT                         //finally exits

:CPP
cmd /C if exist "$(NAME_PART).exe" cmd /c del "$(NAME_PART).exe"
g++ "$(FILE_NAME)" -o $(NAME_PART)
IF $(EXITCODE) != 0 GOTO EXITSCRIPT
echo C++ CODE COMPILED SUCCESSFULLY:
$(NAME_PART)
GOTO EXITSCRIPT

:JAVA
cmd /C if exist "$(NAME_PART).class" cmd /c del "$(NAME_PART).class"
javac $(FILE_NAME) -Xlint
IF $(EXITCODE) != 0 GOTO EXITSCRIPT
echo JAVA CODE COMPILED SUCCESSFULLY:
java $(NAME_PART)
GOTO EXITSCRIPT

:C#
cmd /C if exist "$(NAME_PART).exe" cmd /c del "$(NAME_PART).exe"
csc $(FILE_NAME)
IF $(EXITCODE) != 0 GOTO EXITSCRIPT
echo C# CODE COMPILED SUCCESSFULLY:
$(NAME_PART)
GOTO EXITSCRIPT

:PYTHON
echo RUNNING PYTHON SCRIPT IN CMD:              //python is a script so no need to compile
python $(NAME_PART).py
GOTO EXITSCRIPT

:EXITSCRIPT
// that's all, folks!

Right here, now first off, I must say it is not mine but rather it rightfully belongs to JerryGoyal who I thank for the semi-working code with all my gratitude, but there is a problem with the code.

While the code in NppExec does execute the python files without a problem it has problems with the C++ files, when I press F6 to run all I get is the following:

"CreateProcess() failed with error code 2:
The system cannot find the file specified."

Note that I have specified the full path of C++ compiler in the environment variables PATH. So what could be causing the problem?

Community
  • 1
  • 1
  • I assume you don't have `g++` installed? – Martin Tournoij Dec 31 '16 at 02:04
  • Actually I do, the path leading to g++ was also put in the PATH. – SteyrMozzy Dec 31 '16 at 08:59
  • When I said 'c++' I actually meant 'g++', it was a typo what I first wrote. – SteyrMozzy Dec 31 '16 at 09:01
  • If there is a mistake in the question then please [edit] it. (See the [edit] link just above these comments.) Please also read [mcve] and then change your script to be a minimal script that has the problem. Many people find that creating a [mcve] enables them to solve the problem themselves. – AdrianHHH Jan 03 '17 at 09:39
  • I've fixed my issues. First I uninstalled CodeBlocks, then I downloaded and installed MinGW in the following default directory C:\MinGW – SteyrMozzy Jan 04 '17 at 13:58

0 Answers0