I’ve been looking on google for how to make a custom function in Windows PowerShell so I can simply type
run FILENAME and compile and run code, similar to the Mac-Specific section on the module. But I can’t find anything that tells me what I need for Windows. I’ve looked into this article about Profiles, but I’m still lost.
Wondering if someone could help me out with how to write the function and make it work.
You can make a batch file, then put all of your C++ files into the directory with the batch file.
Inside the batch file:
g++ %1.cpp -o %1.exe -Wall -Wextra && %1.exe
To use it, cd into the directory with your terminal and type:
This should compile and run the file for you.
Thanks for the help @GhOsT. Was able to use some of your code to make my own batch file
echo  - Compiling ..... %1
g++ -std=c++0x %1.cpp -Wall -O2 -o %1.exe
if %errorlevel% == 0 (
echo  - Running ..... %1