Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Problem Compiling C++ programs

  1. #1
    Join Date
    Apr 2011
    Beans
    8

    Problem Compiling C++ programs

    I'm having problems compiling C++ programs. I've tried compiling C++ programs with extension .cc and .cpp. I've tried compiling with gcc, g++ and even cc (with .cc extension files).

    Earlier (as g++ wasn't installed) i tried installing g++ (sudo apt-get install g++) for which i got the message "g++ has no installation candidate". Later from Synaptic i found it as g++-2.95 and installed it. I've also installed pentium-builder

    Whenever i've tried to install "build-essential" (using apt-get and aptitude) i've got messages along the line of "no installation candidate". I've searched many posts and not got the answer for this. I've treid update and upgrade before installation, no use. I have all the repositories checked in software sources and the server as "main server".

    Now, the main problem is: (when trying to compile a .cpp file)
    user@dell-desktop:~$ g++ hello.cpp
    Unable to exec g++.real: No such file or directory

    user@dell-desktop:~$ gcc hello.cpp
    gcc.real: error trying to exec 'cc1plus': execvp: No such file or directory

    user@dell-desktop:~$ cc hello.cpp
    gcc.real: error trying to exec 'cc1plus': execvp: No such file or directory


    (I have ubuntu Intrepid Ibex)

  2. #2
    Join Date
    Apr 2011
    Beans
    44

    Re: Problem Compiling C++ programs

    use synaptic to install build essential

    Post any errors you get aswell

  3. #3
    Join Date
    Apr 2011
    Beans
    8

    Re: Problem Compiling C++ programs

    Sorry if this is a rather dumb question, but how exactly do you find build essential in synaptic?

    If you give quick search with "build essential", you get multiple results (the not installed ones) starting with:
    sbuild, polyxmass-common, gap-libs, gnome-core, kdrill etc. How do you know which are the corresponding packages?

    The already installed ones (from the same search) are: system-services, startup-tasks, gnome-panel, python-minimal, python2.5-minimal, perl-base etc.

  4. #4
    Join Date
    Jan 2011
    Beans
    1,151

    Re: Problem Compiling C++ programs

    https://help.ubuntu.com/community/CompilingEasyHowTo

    you cant be as stupid as me. I have to reinstall an os 3 times in one day lol.

    if you want to be lazy run this in the terminal

    Code:
    sudo apt-get install build-essential checkinstall

  5. #5
    Join Date
    Jun 2007
    Beans
    17,337

    Re: Problem Compiling C++ programs

    (I have ubuntu Intrepid Ibex)
    Ibex is well past end of life, did you adjust your sources to reflect that (to the old-releases source entries

    Could be something like this (though I've never had reason to do so
    Code:
    deb http://old-releases.ubuntu.com/ubuntu/ intrepid main restricted universe multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ intrepid-updates main restricted universe multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ intrepid-security main restricted universe multiverse
    or here is a slightly different layout (uses gutsy, you're intrepid
    http://soniahamilton.wordpress.com/2...ons-of-ubuntu/
    Last edited by mc4man; April 27th, 2011 at 04:19 AM.

  6. #6
    Join Date
    Apr 2011
    Beans
    8

    Re: Problem Compiling C++ programs

    Quote Originally Posted by idoitprone View Post
    https://help.ubuntu.com/community/CompilingEasyHowTo

    you cant be as stupid as me. I have to reinstall an os 3 times in one day lol.

    if you want to be lazy run this in the terminal

    Code:
    sudo apt-get install build-essential checkinstall

    I got this:

    user@dell-desktop:~$ sudo apt-get install build-essential checkinstall
    [sudo] password for user:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Package build-essential is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    E: Package build-essential has no installation candidate

  7. #7
    Join Date
    Apr 2011
    Beans
    8

    Re: Problem Compiling C++ programs

    Quote Originally Posted by mc4man View Post
    Ibex is well past end of life, did you adjust your sources to reflect that (to the old-releases source entries

    Could be something like this (though I've never had reason to do so
    Code:
    deb http://old-releases.ubuntu.com/ubuntu/ intrepid main restricted universe multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ intrepid-updates main restricted universe multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ intrepid-security main restricted universe multiverse
    or here is a slightly different layout (uses gutsy, you're intrepid
    http://soniahamilton.wordpress.com/2...ons-of-ubuntu/
    bash: deb: command not found

  8. #8
    Join Date
    Feb 2006
    Location
    /home
    Beans
    237

    Re: Problem Compiling C++ programs

    build-essential should be pulled in from module-assistant

    so,

    Code:
    sudo apt-get install module-assistant
    then
    Code:
    m-a update
    select prepare from menu and let it pull in the required libraries.
    You should be able to compile after that.
    Asus P5K | Core2Quad Q6600 2.4Ghz | 8GB Corsair XMS2 DDR2 800Mhz Dual Channel | Nvidia GeForce 210 1GB Vid Ram | Dual Boot Win7 for Half Life! and Debian Squeeze 64bit w/Gnome 2.30 |
    registered Linux User#: 416460

  9. #9
    Join Date
    Apr 2011
    Beans
    8

    Re: Problem Compiling C++ programs

    Quote Originally Posted by SkyNet2029 View Post
    build-essential should be pulled in from module-assistant

    so,

    Code:
    sudo apt-get install module-assistant
    then
    Code:
    m-a update
    select prepare from menu and let it pull in the required libraries.
    You should be able to compile after that.

    After "install module-assistant" and "m-a update" i got the warning: "/user/src/compat-wireless-1.0-4.9 seems to contain unconfigured kernel source!" (module-assistant error message).

    After selecting ok:
    the same warning message, this time with linux-headers 2.6.27-10

    After clicking ok for that:
    the same warning message, this time with linux-headers 2.6.27-7

    After clicking ok for that:
    "You are not root and no replacement directory (the -u option) is specified. Unable to continue."

    The installation of module-assistant went without problems. Can you also tell me exactly what I am doing with these commands?

  10. #10
    Join Date
    Jun 2007
    Beans
    17,337

    Re: Problem Compiling C++ programs

    Quote Originally Posted by ssn2009 View Post
    bash: deb: command not found
    You need to edit your /etc/apt/sources.list, not run in a terminal
    The old intrepid sources don't exist anymore, that's why you get all these type messages
    Package build-essential is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    E: Package build-essential has no installation candidate

    Note to anyone helping the OP - he is running 8.10 (intrepid
    Last edited by mc4man; April 29th, 2011 at 06:29 PM.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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