Find the answer to your Linux question:
Results 1 to 4 of 4
Hello, I have installed gcc-3.3 & g++-3.3 in ubuntu 9.04. Now I want to change the default compiler as gcc-3.3/g++-3.3. After creating links to newly installed gcc/g++, gcc works fine ...
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    3

    Creating link to newly installed g++

    Hello,
    I have installed gcc-3.3 & g++-3.3 in ubuntu 9.04. Now I want to change the default compiler as gcc-3.3/g++-3.3. After creating links to newly installed gcc/g++, gcc works fine but g++ doesn't work.
    When I give "$which gcc" or "$gcc --version" it works fine, but when I give "$which g++" it gives nothing and also "$g++ --version" it gives an error "the program 'g++' can be found in the following packages: * g++..."
    When I installed gcc I gave the command "$configure --perfix=/opt/gcc33 --program-suffix=33 --enable-languages=c,c++" .
    When I give "$which g++33" and "$g++33 --version", work fine.

    I tried following:
    $export CXX=g++33
    $sudo ln -s g++-3.3 g++
    Nothing happens.
    I am very new in Linux and I need to install ns2.1a9b in gcc-3.3. Please help me.

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    is the directory that g++ is installed to on path?

    where did you install g++? what is value of PATH variable? were you in the correct directory when you created a link to g++?

  3. #3
    Just Joined!
    Join Date
    Dec 2010
    Posts
    3
    Quote Originally Posted by coopstah13 View Post
    is the directory that g++ is installed to on path?

    where did you install g++? what is value of PATH variable? were you in the correct directory when you created a link to g++?
    I installed in "/opt/gcc33/" ( --perfix=/opt/gcc33). I made a file "gcc34.sh" (as given in "Installing Alternate GCC Compiler on Fedora" mjmwiredDOTnet/resources/mjm-fedora-gccDOThtml) and export PATH as:
    #!/bin/sh
    GCC33_BIN=/opt/gcc33/bin
    PATH=$GCC33_BIN:$PATH
    export PATH

    When I created the link, I was in "/usr/bin" directory.
    Please let me know, if there is any mistake. Thank you.

  4. #4
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    you made a file called gcc34.sh with those contents?

    all that file does is set a path, so you would need to execute it before having your path set

    the easiest way to add an item to your path variable is to edit your ~/.bashrc file or ~/.bash_profile and put those 3 lines in it, otherwise every time you log in you will need to execute that other file you are talking about

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...