Compile them both at the same time and put the result in a.out
$ g++ file.cpp other.cpp
Compile them both at the same time and put the results in prog2
$ g++ file.cpp other.cpp -o prog2
Compile each separately and then pair them with a.out
$ g++ -c file.cpp
$ g++ -c other.cpp
$ g++ file.o other.o
Compile each separately and then pair them with prog2
$ g++ -c file.cpp
$ g++ -c other.cpp
$ g++ file.o other.o -o prog2
source
share