I downloaded minGW to compile programs in C using the gcc command in the console of Notepad++. I downloaded all the packages so that it could compile other languages as well and I double checked that I have g++.exe just like I have gcc.exe to compile c programs. But I don't get how to get to compile and run c++ programs. I saw the other post, "Getting compiler to work in Notepad", and how he copied and pasted:
NPP_SAVE
CD $(CURRENT_DIRECTORY)
C:\MinGW\bin\g++.exe -g "$(FILE_NAME)"
into the nppExec console. When I do that 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 like it works but what do I do next?
here is the program in notepad++
#include <iostream>
using namespace std;
int main() {
cout << "Hello World";
}
To be honest I have not tried the nppExec plugin before. (I usually use IDE.) But here is an educated guess:
What you typed in made the code compile, but did not execute the resulting executable. You need to specify the output file, and the run it. It is going to be something like this:
NPP_SAVE
CD $(CURRENT_DIRECTORY)
C:\MinGW\bin\g++.exe -g "$(FILE_NAME)" -o prog.exe
prog.exe
"which seems like it works but what do I do next?"
Well, I think this way (mis-)using Notepad++ as an IDE, will at least become clumsy, if you want to manage more than a single source (.cpp
) file.
As pointed out in Gábor Angyal's answer, the 1st step to go, is to compile an executable using the -o
option, and run the created program.
Anyway you should note (if you insist on using Notepad++ instead of a real IDE), that MinGW also supports GNU make (here's a tutorial).
I would recommend to create a Makefile
and compile, link and run your code via this one.
If it comes to debug your programs, I will definitely recommend an at least minimal IDE like CodeBlocks or Geany.
Here's a more extended list of suggested Editors/IDE's: Best C++ IDE or Editor for Windows
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With