If you type
$man g++
Here is the online help page . You probably have some good information. You can also try
$g++ --help
To your question. If you used the -o switch, you can specify the output file to use. So you could do something like
$g++ -c main.cpp -o obj/main.obj
source share