Sounds like you've got an environment problem. Given that you've installed it a couple times, it's probably somewhere on your system. GCC is just being misdirected as to where it is. I don't know what you've done installing it these different ways.
Install Gcc For Mac
If you have the most recent Apple Command Line Tools (macOS 10.nn) for Xcode installed for your operating system version — which you get from developer.apple.com/download/more, then you need a package manager (e.g. homebrew) to install, and compile GCC and all of its dependencies. That compilation process will take at least an hour. After you initially install homebrew (brew):
# In the bash shell (e.g. .bash_profile), gag Google Analytics in Homebrew.
export HOMEBREW_NO_ANALYTICS=1
brew update
brew upgrade
brew info gcc
brew install gcc
Gcc Macro For Function Name
brew cleanup (this removes previous application/dependency revisions saving considerable space)
Gcc For Mac Os X
The gcc application will be installed by default in /usr/local/bin.
Gcc Compiler For Mac Os Mojave
Personally, I use Apple's clang/clang++ compilation tools rather than deal with GNU gcc.