A compiler does not execute binary files! It, hopefully, creates them, but executing them is something that is not done by the compiler. Compilation of a c++ programme with g++ is as follows:
g++ -o prog prog.cpp
where prog is the binary created and prog.cpp is the source. Executing it means that you have to type
in the right directory, where prog is. If prog is in your $PATH, then you can simply type prog in the console in any directory.