How to change default gcc and g++ version

Latest response

Hi

After installing RHEL 7.2 and Dev. Tool 4.1, the system gcc is 4.8.5 and the gcc used by eclipse is 5.3.1.

Is it possible to change the default gcc version to the one used by the dev. toolset?

And, are there any adverse effects to doing this?

Thanks

Responses

Hi Henrik,

Software Collections aren't really designed to serve as the default. That said, it's possible to set up an environment that uses the versions provided by Software Collections (such as DTS):

There shouldn't be any adverse effect, but you should keep in mind potential compatibility issues. See 'Compatibility' in the DTS User Guide.

Hi Robert

Ok. My use-case is that I have installed NSight, which is based on Eclipse, but which is run outside the Dev-Tool 4 environment.

However, I would like to enable the later gcc version without having to manually modify all my projects.

Is it possible to make an addition to the path used to launch nsight? Should I then just add a scl enable devtoolset-4 before the nsight launch?

Thanks again

Hi Henrik,

I'm not familiar with NSight, but yes, that's how it should work. Just use the scl command to launch your application. To quote from the DTS User Guide:

Note that you can execute any command using the scl utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent.

This would look like the following in your case:

scl enable devtoolset-4 'nsight'
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.