New course! Every coder should learn Generative AI!
Try a free lesson0
How to run a c++ program in notepad++
I'm confused about how to run a c++ program using notepad++
2 Answers
+ 1
So you need a compiler go to this website https://sourceforge.net/projects/mingw/files/Installer/
Then download the mingw-get-setup.exe.
Once downloaded run the exe and install the install manager.
When that finishes the manager will open and check:
mingw32-base and mingw32gcc-g++
Then click top left Installation tab and then "apply changes"
After that is done go to file explorer and right click "This PC", then click "properties".
Then on left side "Advanced system settings" and then "Environment Variables".
Now under system variables look for "Path" and click on it and hit "edit"
Then hit "New" and then add this directory C:\MinGW\bin
After that is done hit "ok" on everything and you can now use the compiler.
Now go to the location where you have your code or your yourfile.cpp file and while in that
directory click on the directory and type powershell and hit enter.
If done correctly powershell will open in that directory and now to compile your code
you type in console:
for c code: gcc yourfile.c -o yourfile.exe
for c++ code: g++ yourfile.c -o yourfile.exe
if your code was written correctly you will now have a .exe file which you just click to
run your program.
0
ok thk :D