Installing gcc - recieve error message gcc : cannot execute

AIM- Install Oracle 11g on Solaris using VMWare

Steps

1.Logged on as root
2.Created subfolders � /usr/local/bin & /usr/local/bin/gcc
3.Downloaded gcc & libiconv & unzipped them on my harddrive & burnt them on CD
4.Copied files from CD to /usr/local/bin/gcc
5.Terminal (root) � pkgadd -d /usr/local/bin/gcc /libiconv � successful
6.Terminal (root) � pkgadd -d /usr/local/bin/gcc /gcc � successful
7.pkginfo - i gcc � not seen
8.pkginfo - i SMCgcc � see's it.
9.gcc -version � does not see /usr/local/bin or /usr/local/bin/gcc

but modify

path of install..I add /etc/.profile
PATH=$PATH:/usr/local/bin:/usr/ccs/bin/:/usr/local/bin/gcc; export PATH
Save and restart
11.
echo $PATH --> appears
12.
gcc - version --> gcc : cannot execute

What have I missed ?
Any assistance greatly appreciated....

If you create a directory named /usr/local/bin/gcc, you'll have a hard time running a command being /usr/local/bin/gcc too.

What Solaris version is this ?

Explain please - your statement (new Solaris)

Solaris 10

You cannot execute a directory. Your steps 2 and 4 are broken.

If you are using Solaris 10, there is no need to install gcc given the fact it is already bundled with the OS.
Just use "/usr/sfw/bin/gcc".

Appreciate your comments.

q1
So, do I need to add "/usr/sfw/bin/gcc" to
path of install..I add /etc/.profile
PATH=$PATH:/usr/local/bin:/usr/ccs/bin/:/usr/sfw/bin/gcc; export PATH ?

So, when I try "gcc - version " will output correctly?

q2
In general, how do you install package correctly ? say if gcc (any package) was not installed. Where would you install it ? Would you not create folder, unzip it and then run package from there ?

Thanks again.

No, you need to put /usr/sfw/bin (without /gcc) in your PATH.
The PATH variable is a list of directories where the shell looks for executables. /usr/sfw/bin/gcc is an executable, not a directory.

Under Solaris, the command is "pkgadd " with various options.

Don't confuse the temporary location where you download the package file and the location where the package files are deployed. The former is some temporary directory your can safely remove after the operation while the latter is (usually) hard-coded by the package creator.

No, and that is the problem you had. Don't create any target directory. The pkgadd command will do it for you. And don't create temporary directories in locations that belong to the OS, like /usr.
Use /tmp, /var/tmp, your home directory or top level non standard directories (eg: /software) for your temporary files.

Greatly appreciated for comments.

Gives me better understanding of packages now. (come from Windows environment)

Last 2 questions

q1
Does this mean, I need to uninstall gcc package I installed ?
Use gcc that is supplied from o/s.

q2
gcc is part of o/s in solaris 10 - "statement"
If I run the command, "pkginfo -i gcc" why does it say package not found ?
But, if I run command "pkginfo -i SMCgcc" see's it. (the one I installed)

Can you explain please ???

Solaris package name is SUNWgcc, not gcc. If you have it installed, you can safely remove SMCgcc.

Thanks