Trivially
g++ sample.c
generates a.out
Can g++ be configured to output to a different default name for output file ?
specify output file name This option tells g++ to place its output in the file output-file. If -o is not specified, the default is to put the executable output in a file named in a. out and the object file for source.
DIFFERENCE BETWEEN g++ & gccg++ is used to compile C++ program. gcc is used to compile C program.
G++ is the name of the compiler. (Note: G++ also compiles C++ code, but since C is directly compatible with C++, so we can use it.).
You need to use the -o
option of g++
g++ -o output_file_name source.cpp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With