We install the MinGW C/C++ compilers on Windows. Then we compile and run a C++ Hello World program using G++.
Sometimes it's nice not having to use a heavy weight IDE, but how to compile C/C++ code without an IDE? In this video we install C and C++ compilers for Windows which you can invoke from a command line. We code a simple Hello World program and then compile and run it from CMD.
Download compilers from here:
https://www.mingw-w64.org/
Download 7-Zip:
https://www.7-zip.org/
Hello World Program:
https://pastebin.com/3v994QFf
- - - Compile Commands - - - -
Compile main.cpp to main.exe:
g++ main.cpp - o main
Compile main.cpp and foo.cpp to main.exe:
g++ main.cpp foo.cpp -o main
Compile all cpp files to main.exe
g++ *.cpp - o main
Compile main.cpp and headers in include to main.exe
g++ hello.cpp -I include -o main
Chapters:
0:00 - Compile & run from command line
0:21 - Download MinGW compiler
1:42 - Extract the compilers
2:28 - Add compiler directory to PATH variable
3:32 - Test if it worked
4:00 - Coding a Hello World program
5:03 - Compiling the program
5:33 - Thanks!