Announcement

Collapse
No announcement yet.

C Compilers

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    C Compilers

    I am a former main-frame programmer who would like to learn C on my Kubuntu box.

    The programming books that I have refer to the C compiler as 'cc' or 'gcc'. I have installed on my Kubuntu box the following:
    gcc-4.0
    gcc-4.0-base
    gcc-4.0-doc

    But I also have [NOT installed] the following:
    gcc
    gcc-3.3
    gcc-3.3-base
    gcc-3.4
    gcc-3.4-base
    gcc-3.4-doc
    gcc-doc

    I am presuming that gcc-4.0 is the latest and greatest, but that the others are for people who have some reason to use an earlier version.

    Now assuming that all the above is true, how do I set up an 'alias' or 'link' to gcc-4.0 so that I can execute the command as 'cc' or 'gcc', rather than typing the command as 'gcc-4.0'?

    Thanks for your encouragement; this is one great forum, and Kubuntu is one GREAT distro!

    #2
    Re: C Compilers

    I got that symlink by default without having to do anything. If you don't have it, you can create it with:

    cd /usr/bin
    sudo ln -s gcc-4.0 gcc

    Comment


      #3
      Re: C Compilers

      Often, when there are multiple versions of a package in the repo, there will be one without a version number, as in this case. These 'dummy' packages refer to the latest versoin. So had you installed the package gcc you would have in effect installed gcc-4.0. I suspect that doing it this way will set up the symlinks for you so that gcc, ld, etc. will point to the latest versions. So in short, try installing gcc.

      Comment


        #4
        Re: C Compilers

        Here's what I found out after reading the above two messages:

        In /usr/bin:
        gcc -> gcc-4.0

        Also, in /usr/bin:
        cc -> /etc/alternatives/cc

        And, in /etc/alternatives:
        cc -> /usr/bin/gcc

        So, in effect, /usr/bin/gcc AND /usr/bin/cc -> gcc-4.0. So I can use either to run the gcc 4.0 compiler.

        Now, if I wanted to install gcc-3.4 IN ADDITION TO gcc-4.0, I should check these links AFTER I install gcc-3.4 to make sure that they have not been changed, and then manually set up a separate link to gcc-3.4.

        For example, the HOW-TO for setting up the VMWare server with WinXP as a virtual machine calls for gcc-3.4. I don't know if such is REQUIRED, or if that was just the version number when the HOW-TO was written. It may be that gcc-4.0 will work just as well.

        Thanks for pointing me in the right direction. Any additional comments are welcomed.

        Comment

        Working...
        X