> It appears to me that mostly relative positions of options do not matter
Yes.
> when would these position matter?
Among the commonly used options, the position of an option specifying a library to link with is significant. In general, put these right at the end.
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, ‘foo.o -lz bar.o’ searches library ‘z’ after file foo.o but before bar.o. If bar.o refers to functions in ‘z’, those functions may not be loaded. https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Link-Options.html#Link-Options
> gcc vs g++: When to choose one over other?
gcc is the C compiler driver; use it to compile C code
g++ is the C++ compiler driver; use it to compile C++ code