[Courses] Re : C Programming for Absolute Beginners, text book?

Carla Schroder carla at bratgrrl.com
Tue Feb 7 18:37:15 UTC 2012


> I subscribe to the many thanks Carla received. Best first lesson ever!
> Thanks everybody for all the comments (haven't been able to fully
> understand all of them...) and questions which helped me think more about
> the little things.
> 
> My question is related to what I have encounter so far trying to compile
> other people codes: which/where is the difference in using gcc or cc while
> compiling?  I can see this example works for both of them, but I know this
> is not "universal".
> 
> Thanks!
> Diana

I love when the brainiacs chime in :)

cc is linked to gcc, which you can see a number of different ways:

$ stat /usr/bin/cc
  File: `/usr/bin/cc' -> `/etc/alternatives/cc'
  Size: 20        	Blocks: 0          IO Block: 4096   symbolic link
Device: 802h/2050d	Inode: 1070655     Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)


$ stat /usr/bin/gcc
  File: `/usr/bin/gcc' -> `gcc-4.6'
  Size: 7         	Blocks: 0          IO Block: 4096   symbolic link
Device: 802h/2050d	Inode: 1047149     Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)


When you look in /etc/alternatives you see another cc > gcc links, and how C89 
and C99 standards support are handled:

$ ls -l /etc/alternatives | grep cc
lrwxrwxrwx 1 root root  12 Jun  2  2011 cc -> /usr/bin/gcc
lrwxrwxrwx 1 root root  16 Jun  2  2011 c89 -> /usr/bin/c89-gcc
lrwxrwxrwx 1 root root  16 Jun  2  2011 c99 -> /usr/bin/c99-gcc


This Stackoverflow discussion goes into some interesting minutiae on the finer 
points of cc vs. gcc:

Invoking GCC as “cc” versus “gcc”
http://stackoverflow.com/questions/939989/invoking-gcc-as-cc-versus-gcc

best,
Carla

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Carla Schroder, ace Linux guru and howto author
541-932-4817 PT
carla at tuxcomputing.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


More information about the Courses mailing list