2

I'm new to Notepad++ and C++ programming language. I couldn't figure out what has gone wrong, albeit, it might look simple to resolved to many. Tried to search for solution, but to no avail. While trying to config the application for C++ compiler on Windows 8.1, I encountered the below message.

NPP_SAVE: C:\Users\rolle_000\Desktop\HelloWorld.cpp
CD: C:\Users\rolle_000\Desktop
Current directory: C:\Users\rolle_000\Desktop
Compiled.exe -c -w "HelloWorld.cpp"
CreateProcess() failed with error code 2:
The system cannot find the file specified.

================ READY ================

The C++ basic code, simple to testing only.

// A hello world program in C++

#include<iostream>
using namespace std;

int main()
{
    cout << "Hello World!";
    return 0;
}

The NppExec script taken from

How to compile and run C files from within Notepad++ using NppExec plugin? Below embedded mine, script hasn't change much.

NPP_SAVE
CD $(CURRENT_DIRECTORY)
Compiled.exe -c -w "$(FILE_NAME)"

Pls advice, thank you.

Community
  • 1
  • 1
Edwin
  • 33
  • 1
  • 1
  • 6

1 Answers1

1

You're trying to execute a

Compiled.exe

which indeed doesn't exist (yet) instead of the

perl.exe -c -w "$(FILE_NAME)"

perl.exe is the perl's executable and is supposed to be used with a perl's program. To compile C++ programs you will need to use a C++ compiler.

Now: this all boils down to the compiler you want to use... which one are you going to use? MSVC (Microsoft Visual Studio) ? Bloodshed dev-cpp?

Example: if you have MSVC2010 installed you might use:

  1. Execute Start->All Programs->Microsoft Visual Studio 2010->Visual Studio Tools->Visual Studio Command Prompt (2010)

  2. Digit cl (yourFileName).cpp

  3. You're done, yourFileName.exe should now exist

So the above would have to be rewritten as:

cl.exe "$(FILE_NAME)"

after making sure the path to cl.exe is correctly available.

Marco A.
  • 43,032
  • 26
  • 132
  • 246
  • I did change perl.exe to Compile.exe, which initially thought it's only a prefix of a new filename for every compiled code. – Edwin Feb 03 '14 at 11:17
  • What compiler are you planning to use? MSVC2010/2012 ? – Marco A. Feb 03 '14 at 11:19
  • I did change perl.exe to Compile.exe, which initially thought it's only a prefix of a new filename for every compiled code. I have used Bloodshed dev-cpp in my older laptop, however, not in this brand new laptop I'm working on. The older laptop works with both installed. Problem is its has been more than a year ago. Hence, the need to repeat the installation and config on my new laptop.. My question is does Bloodshed dev-cpp have to exist (as in pre-installed) in order for Notepad++ to be a C++ compiler? If that's the case, I will install to necessitate the compile function. Thank you. – Edwin Feb 03 '14 at 11:29
  • Notepad++ ISN'T a compiler, it just asks a compiler to compile your program. And yes, you must have a compiler installed (dev-cpp, visual studio ..) to compile stuff via notepad++. Notepad++ just helps you write stuff, doesn't compile anything by itself. – Marco A. Feb 03 '14 at 11:46
  • Hi David, I got your point clear! Thanks for you patience! Trying out MinGW to minimize IDE. – Edwin Feb 04 '14 at 06:56
  • MinGW has a port of the gcc compiler, that will surely work to compile your program if correctly configured. – Marco A. Feb 04 '14 at 10:16
  • I have finally made it. Took quite a bit of searching to get the right script F6 execute. And also, at the initial stage there is a missing file. However, got over it by adding the Path in windows system config. Here is an extract of the script from somewhere www. Thank you! cmd /c C:\MinGW\bin\g++.exe -ansi -pedantic -Wall -W -Wconversion -Wshadow -Wcast-qual -Wwrite-strings $(FILE_NAME) -o $(NAME_PART).exe & IF ERRORLEVEL 1 (echo. && echo Syntax errors were found during compiling.) ELSE ($(NAME_PART).exe) – Edwin Feb 04 '14 at 10:26