Public Group

# anyone familiar with Unix?

This topic is 4816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hey if someone is and can gimme some help here, i'd be grateful. ok, so i'm having trouble using gcc... i use the ssh (secure shell client), connect to my university and do my work or what not. well, i tried compiling my file: >gcc ll.c gcc: Command not found. That's what i got, so i compiled like this: >cc ll.c which produced an a.out. so i typed this: >a.out a.out: Command not found. So i remembered something and typed >./a.out and that displayed some results. I've been trying to google some help, but i'm not good with Unix so didn't wanna touch the .localenv without consulting on here first. When i do > echo $PATH /opt/gnu2.7.2.3/bin:/opt/bin:/opt/SUNWspro/bin:/usr/openwin/bin:/usr/bin:/usr/ccs/bin:/usr/ucb:/opt/X11R5/bin:/opt/lib/plt/bin I looked at the .localenv file, which has this in it: setenv NEWPATH${NEWPATH}:/opt/lib/plt/bin setenv MANPATH ${MANPATH}:/opt/lib/plt/man setenv LD_LIBRARY_PATH${LD_LIBRARY_PATH}:/opt/sfw/lib Can anyone tell me what's going on here and what I may do to get gcc working? and why does ./a.out work when a.out doesn't? Thanks in advance.

##### Share on other sites
cc is usually just a symlink to gcc anyway. Not sure why you don't have a file named "gcc" in your PATH, but I'm sure cc will work fine. Just typing "a.out" doesn't work because there is no file in the any of the directories in PATH called "a.out", the "./" at the beginning basically means "the current directory," so you are executing the file in the current directory called "a.out".

##### Share on other sites
cc generally isn't a simlink on solaris machines [as that is], as it's usually Sun's compiler. gcc if installed is often in /opt on solaris machines, so you can look around there for it.

iirc Suncc also takes a -o flag to rename the executable. cc -o ll ll.c for example.

##### Share on other sites
if gcc is in fact installed, you can try:
$find / -name "gcc" if that returns something like say: /usr/local/bin/gcc then add /usr/local/bin to your PATH, IE:$ setenv PATH ${PATH}:/usr/local/bin and then do:$ gcc -v

to find out which version it is.

if find does not return a thing, is not installed, or is out of your reach, work with cc.

##### Share on other sites
your on a Solaris box. Sun doesn't support gcc on Solaris?

whoever set up your .login file, probably a default one for all student users, didn't add the current directory (.) as part of the path, so you're going to have to do that yourself if you don't want to type in ./a.out to execute your binary.

be aware though that this means that if you ever change directories, to the /tmp directory for instance, you could possibly run a binary from that directory when you didn't intend to. that's why it's normally not put in there for beginners.

if you want to add the current directory, i'd suggest adding it to your .cshrc file, and have it appended to the end of the default .login path, like so:

if (! $?OLDPATH ) then setenv OLDPATH$PATH # save original      setenv PATH /usr/local/bin${PATH}: # adjust as neededendif #### Share this post ##### Link to post ##### Share on other sites To get help on any command in Unix/Solaris type the following: man commandname In this case cc is the commandname you would be looking for. #### Share this post ##### Link to post ##### Share on other sites Quote:  Original post by Anonymous Posterwhoever set up your .login file, probably a default one for all student users, didn't add the current directory (.) as part of the path, so you're going to have to do that yourself if you don't want to type in ./a.out to execute your binary. ... Yeah, that's a bad idea, never add . to your path, this may seem as something someone "forgot" to do to DOS/Windows cmd.com users, but after a while using *nix, you'll get used to it. You may want to add /home/yourusername/bin to your path in case you decide to install some programs on/for your own without having access to the root account. #### Share this post ##### Link to post ##### Share on other sites Quote:  Original post by Kwizatzif gcc is in fact installed, you can try:$ find / -name "gcc"if that returns something like say:/usr/local/bin/gccthen add /usr/local/bin to your PATH, IE:

hey,
i tried your find command and got this:
find: cannot read dir /var/preserve/jana: Permission denied
find: cannot read dir /var/preserve/ananth: Permission denied
...
..
.
...
..
.
and then I ctrl-c it to stop it. ha, what does all this mean?

Funny thing is, I remember using gcc a while back. and even though you're all basically explaining what to do, I'm not fluent with Unix so if you could list the exact commands etc., i can then try those.

Thanks again.

##### Share on other sites
Update: I was taking a look at the .cshrc name '.cshrc-2004' and in it, I find this:

source ~caviness/Class/CISC181013/.classrc

Caviness was a teacher I had for my CISC181 class (C++ I think). why does it specifically name him and his directory? that's the only line in .cshrc-2004.

Edit: Sorry about that, being too hasty. I did find .cshrc file, and it has a lot more stuff in it, if anyone wants to see it, I can post it. But then, why do i have the 2004 file?

Update: thanks everyone, don't worry about it. found out gcc is no longer included.

[Edited by - red-dragonX on September 10, 2005 9:59:24 PM]

##### Share on other sites
Quote:
 Original post by red-dragonXhey,i tried your find command and got this:find: cannot read dir /var/preserve/jana: Permission deniedfind: cannot read dir /var/preserve/ananth: Permission denied......find: cannot read dir /var/sadm/patch/113718-01/: Permission deniedfind: cannot read dir /var/sadm/patch/113476-05/: Permission denied......and then I ctrl-c it to stop it. ha, what does all this mean?

Just to answer your question, that means you have no permision to see whats under the directories listed, as such, even if gcc was inside any of those, you would not have access to it.

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 9
• 27
• 20
• 14
• 14
• ### Forum Statistics

• Total Topics
633388
• Total Posts
3011622
• ### Who's Online (See full list)

There are no registered users currently online

×