About the hardest part of command line building is using the console Change Directory (CD) and PATH commands. What I do to use TDM-GCC-64, is create a project directory somewhere or other where I want to keep my source code, and open a command prompt window, i.e., execute Cmd.exe in C:\Windows\System32. It opens up of course to...
Then I CD back to root...
Then change directory to where I put my source code - let's say, for example....
CD C:\Code\Mingw\Hello [ENTER]
Then execute PATH command so gcc 'build chain' can be found from command prompt. The TDM-GCC-64 on this laptop came with an Embarcadero Bloodshed C++ installation, so for me it's here....
C:\Program Files (x86)\Embarcadero\Dev-Cpp\TDM-GCC-64
...and under that in a \bin subdirectory are the various binaries comprising the build chain. So at my console prompt in my code directory I execute this...
Set Path=C:\Program Files (x86)\Embarcadero\Dev-Cpp\TDM-GCC-64\bin
You can just type PATH [ENTER] after doing that to make sure it all 'took'.
If by chance you have a TDM-GCC installation (stand alone not part of IDE install), when the installer runs it asks whether or not you want the build chain added to your PATH environment variables, and if that's the case you don't need to manually set the path as I've described above.
Anyway, here's a Hello World test program and my command line string using g++...
// Set Path=C:\Program Files (x86)\Embarcadero\Dev-Cpp\TDM-GCC-64\bin
// g++ Hello.cpp -oHello_gcc.exe -mconsole -m64 -s -Os
The -s switch strips debug symbols from executable, and -Os optimizes for code size.