Getting Notepad ++ to compile and run C ++ programs using minGW

I downloaded minGW to compile C programs using the gcc command in the Notepad ++ console. I downloaded all the packages so that it could compile other languages ​​as well, and I double-checked that I have g ++. Exe, like gcc.exe for compiling c-programs. But I don’t understand how to get the opportunity to compile and run C ++ programs. I saw another entry “Getting the compiler to work in Notepad” and how it copied and pasted:

NPP_SAVE CD $(CURRENT_DIRECTORY) C:\MinGW\bin\g++.exe -g "$(FILE_NAME)" 

in the nppExec console. When I do this, I get:

 NPP_SAVE: C:\Tutorial\helloWorld.cpp CD: C:\Tutorial Current directory: C:\Tutorial C:\MinGW\bin\g++.exe -g "helloWorld.cpp" Process started >>> <<< Process finished. (Exit code 0) ================ READY ================ 

which seems to work, but what should I do next?

here is the program in notepad ++

 #include <iostream> using namespace std; int main() { cout << "Hello World"; } 
+5
source share
3 answers

To be honest, I have not tried the nppExec plugin before. (I usually use an IDE.) But there is a reasonable assumption here:

What you entered made you compile the code, but did not execute the resulting executable. You need to specify the output file and run it. It will be something like this:

 NPP_SAVE CD $(CURRENT_DIRECTORY) C:\MinGW\bin\g++.exe -g "$(FILE_NAME)" -o prog.exe prog.exe 
+4
source

"which seems to work, but what should I do next?"

Well, I think this way (wrong), using Notepad ++ as the IDE, will at least become awkward if you want to manage more than one source ( .cpp ).

As stated in the Gábor Angyal answer , the first step to execution is to compile the executable using the -o option and run the created program.

In any case, you should note (if you insist on using Notepad ++ instead of a real IDE), then MinGW also supports GNU make ( here is a tutorial ).
I would recommend creating a Makefile and compiling, linking and running your code through this one.

If you need to debug your programs, I definitely recommend at least a minimum IDE, such as CodeBlocks or Geany .

Here's a more extensive list of suggested editors / IDEs: Best C ++ IDE or Editor for Windows

+3
source

Job script:

 NPP_SAVE CD $(CURRENT_DIRECTORY) C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\g++.exe -g "$(FILE_NAME)" 
-1
source

Source: https://habr.com/ru/post/1211851/


All Articles