how to compile c++ program in command prompt code example Example: c++ compile to exe command line gcc sourcefile_name.c -o outputfile.exe