Quote:
Originally Posted by salmanmanekia
i am supposed to know how many versions of gcc are installed on my system
|
That might be very difficult. There is a lot of flexibility when installing gcc from source. You can easily customize its name and/or location to install a version of gcc that you can use on demand without conflicting with the default version or other extra versions.
The many versions of gcc on the systems where I work are in strange automounts across the network, so they aren't in the database used by locate and some of the auto mount directories seem to be invisible to wild cards until explicitly accessed. So on
my system finding the gcc executables at all would be hard if I didn't know where to look.
But on a less strange system, I expect the main executable for any version of gcc is likely to have "gcc" as part of its name. It shouldn't be too hard to run a search for all files that have "gcc" in their name (likely to be quite a lot) and automatically run "file" for each to filter for just the ones that are ordinary executables (which should be a more manageable list) and then just look at the list and guess/test (should be easy) which are the main executables of installed versions of gcc.
Quote:
and which one is the default one..??..
|
But that ought to be easy. As karamarisan said
gcc -v