set
doesn't create an alias, it sets a variable.
So set -x g++ something
is trying to set a variable called "g++" to the value "something" and export it (the "-x").
Now, you most likely want to do what ridiculous_fish suggested and define an actual alias (or a function - which alias
desugars to, or an abbreviation) with alias
or function
or abbr
.
Also, the "+" character isn't allowed in variable names. That's because, while fish could allow it, other shells don't. And since variables can be exported, their names need to be compatible with those (try g++=something
in bash - it'll try to run it as a command). See Allowed characters in linux environment variable names for further information.