If you don't mind me asking - which version of QT is being used to create the application you are trying to build?
And is there any particular reason why you need gcc 4.7? Is the application quite old? or is there another reason?
As Ryan has stated - You can install multiple versions of gcc alongside each other.
As for compiling a QT application with a different version of gcc - you may be able to change your default compiler to g++-4.7.
I'm on my lunch-break at work, so not near a Linux PC ATM, but if memory serves - I think the easiest way would be to redirect g++ to g++-4.7.
Normally g++ is a symbolic link to the latest version of g++. So if you have g++-8.0 installed, then g++ will be a symbolic link to the g++-8.0 executable.
You can combine the file and which commands to find out what type of file your default g++ is:
I think that will output something like:
Code:
/path/to/g++: symbolic link to /path/to/g++-8.0
NOTE: /path/to/g++ will NOT be in the output, it will be something more like /usr/bin/g++
IF your default g++ is a symbolic link
AND IF you have g++ 4.7 installed - then as root, you could try removing the symbolic link to g++-8.0 and add a link to the g++-4.7 executable instead.
Something like this:
Code:
sudo rm /path/to/g++
sudo ln -sT /path/to/g++-4.7 g++
Again, replace /path/to/ with whatever the appropriate path is!
And those commands should make g++-4.7 your default version of g++.
And of course you can always restore the sym-link to g++-8.0 after you have finished working on the QT application.
But again - This potential solution would ONLY work IF you have g++-4.7 installed AND IF g++ is a sym-link to a particular version of g++.