getting g++/gcc compiler to work

Discussion in 'Linux' started by 7am3s, Apr 29, 2009.

  1. 7am3s

    7am3s

    Joined:
    Apr 29, 2009
    Messages:
    2
    Likes Received:
    0
    Does anyone know how I can get the c++ comiler working on my AA1? It's running FC8 underneath all the acer modifications but it seems to be missing a lot of stuff needed for g++ or gcc. The error is posted below from an attempted to compile the textbook 'hello world' program. I've also put below it the packages it seems to have installed.

    Thanks in advance
    James

    [user@localhost]$ g++ hello.cpp -o hello
    In file included from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/i386-redhat-linux/bits/c++config.h:35,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:43,
    from hello.cpp:3:
    /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/i386-redhat-linux/bits/os_defines.h:39:22: error: features.h: No such file or directory
    In file included from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/i386-redhat-linux/bits/c++locale.h:41,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:45,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios:43,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream:44,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:44,
    from hello.cpp:3:
    /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring:52:20: error: string.h: No such file or directory
    In file included from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/i386-redhat-linux/bits/c++locale.h:42,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:45,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios:43,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream:44,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:44,
    from hello.cpp:3:
    /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio:53:19: error: stdio.h: No such file or directory
    In file included from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/i386-redhat-linux/bits/c++locale.h:43,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:45,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios:43,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream:44,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:44,
    from hello.cpp:3:
    /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale:50:20: error: locale.h: No such file or directory
    In file included from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:45,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios:43,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream:44,
    from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:44,
    from hello.cpp:3:
    /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/i386-redhat-linux/bits/c++locale.h:44:38: error: langinfo.h: No such file or directory
    /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/i386-redhat-linux/bits/c++locale.h:45:56: error: iconv.h: No such file or directory
    /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/i386-redhat-linux/bits/c++locale.h:46:39: error: libintl.h: No such file or directory
    .....etc for a few more 100 lines..

    [user@localhost bits]$ pwd
    /usr/include/c++/4.1.2/i386-redhat-linux/bits
    [user@localhost bits]$ ls
    atomic_word.h c++locale.h cxxabi_tweaks.h gthr-tpf.h
    basic_file.h cpu_defines.h gthr-default.h messages_members.h
    c++allocator.h ctype_base.h gthr.h os_defines.h
    c++config.h ctype_inline.h gthr-posix.h time_members.h
    c++io.h ctype_noninline.h gthr-single.h
    [user@localhost ~]$ rpm -qa | grep gcc
    gcc-4.1.2-33
    libgcc-4.1.2-33
    gcc-c++-4.1.2-33
    gcc-objc-4.1.2-33
    gcc-objc++-4.1.2-33
    [user@localhost ~]$ rpm -qa | grep c++
    libstdc++-4.1.2-33
    libsigc++20-2.0.18-1
    libstdc++-devel-4.1.2-33
    compat-libstdc++-33-3.2.3-62
    gcc-c++-4.1.2-33
    gcc-objc++-4.1.2-33
    [user@localhost ~]$
     
    7am3s, Apr 29, 2009
    #1
  2. 7am3s

    HappyHarry

    Joined:
    Nov 28, 2008
    Messages:
    159
    Likes Received:
    0
    do a yum whatprovides on the files that it complains about being missing and install the resulting packages ;) eg

    Code:
    su -c 'yum whatprovides */langinfo.h'
    
    phil
     
    HappyHarry, Apr 29, 2009
    #2
  3. 7am3s

    7am3s

    Joined:
    Apr 29, 2009
    Messages:
    2
    Likes Received:
    0
    glibc-headers.i386 : Header files for development using standard C libraries (and other irrelevant stuff).

    Installed this and all works great. Seems far to easy, I can't believe thats all the pain I'll get from the c compiler.

    Thanks very much!

    James
     
    7am3s, Apr 29, 2009
    #3
  4. 7am3s

    madd0ct0r

    Joined:
    May 14, 2010
    Messages:
    8
    Likes Received:
    0
    um could somebody explain this to a complete linux noob?

    I've just about understood that full linux contains a C++ complier (c++ became g++ became gcc?)

    As such, there's not going to be a 3rd party external program, equivalent to borland or micorsoft dev c++

    And, according to the OP, the header files are missing from the ACER Linpus LINUX thingy.

    I tried the 'yum whatprovides' code exactly as written below.
    The terminal asked me for the password. I haven't the foggiest. I never set one (but it's a 2nd hand laptop...).

    1. Is this irretrievable?

    2. If not, where do I get the glibc header files? and how do I install them? (assuming it differs from a normal prog installation)

    3. Once the header files are in, please, please can someone give me a hint of how to actually start using the complier?
    I'm used to a nice, self contained windows program like msft dev c++
    I suspect this ain't what GNU provides.


    I know this all seems a bit helpless, but I haven't the foggiest what I'm doing.
    Last time I went delving through an OS it was DOS 6.0, I was ten and no permenant damage was done. things seem to have moved on a bit :)
     
    madd0ct0r, May 21, 2010
    #4
  5. 7am3s

    RockDoctor

    Joined:
    Aug 21, 2008
    Messages:
    963
    Likes Received:
    0
    Location:
    Minnesota, USA
    The password you need is for the root account. If you don't have it, the only way I know of to change it is a bit messy, but should work with any distro on a live usb stick:
    1. Boot from the live usb stick
    2. Open a terminal window
    3. Mount your internal drive someplace, say, /opt: sudo mount /dev/sda1 /opt
    4. Chroot to the newly-mounted filesystem: sudo chroot /opt
    5. Change the password: passwd (then just enter the new password when prompted)
    6. Reboot (from your internal drive)
    At this point, you should be able to use yum to install any needed files
     
    RockDoctor, May 22, 2010
    #5
  6. 7am3s

    madd0ct0r

    Joined:
    May 14, 2010
    Messages:
    8
    Likes Received:
    0
    cheers.
    sudo yum seems to be working.

    for the benfit of other noobs who fall across this (there must be another C++ user who's never touched linux before right? :oops: )

    ok.
    references used so far:

    the Netbook Newbie Guide (all five chapters, really very useful)
    starts here:
    http://www.reghardware.co.uk/2008/10/17 ... x_guide_1/

    and how to use the complier:
    http://www.cplusplus.com/forum/beginner/3048/


    'gedit' the editor can be installed on an AA1 by opening a terminal and :

    sudo yum list | grep gedit

    which basically says "Yo! Here's my physic ID card that makes you think I'm in charge (sudo), Take me to Yellowdog Update Manager and list everything. Then ( | ) only show me the stuff containing the word 'gedit'

    installing the files it comes up with, (although you only need gedit.i386 I think) is done by going

    sudo yum install 'filename'


    You don't technically need gEdit, I tried a test program in open-office and linpus will recognise it as a cpp source file if you overide the file extension (in 'save as')
    gedit allegedly gives you that nice colour coordinated code once once it knows it's a cpp source file, which is personally worth the download hassle.


    Likewise, and here we enter the realm of the OP, we can search on yum for the g++ complier, which will handily show us both the parts installed, and the bits still available online.

    This is where I'm stuck now.

    the g++ command still isn't recognised at the terminal (so I'm still behind the OP) , and much like the OP i'm missing the header files.

    BUT, the header files on fedora are linked to an older version of the basic glibc
    I can't download them without having the 2.7-2 version installed; dependency issues.

    the AA1 (mine at least) has the 2.9-2 version installed. This does not allow me to install the older version over it.
    without the older version, I can't get the header files to make either version work.
    It's all gone a bit Microsoft.
     
    madd0ct0r, May 22, 2010
    #6
  7. 7am3s

    RockDoctor

    Joined:
    Aug 21, 2008
    Messages:
    963
    Likes Received:
    0
    Location:
    Minnesota, USA
    glibc-2.7-2 can be found at
    http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/8/Everything/i386/os/Packages/
    Somebody apparently installed the glibc file(s) from Fedora 10, while keeping the Fedora 8 gcc files. Not a situation likely to work.

    Suggested approach #1:
    1. Determine which glibc files are on your system: rpm -qa | grep glibc
    2. Download the version 2.7-2 files of the same name manually from the url given above. For convenience, ensure that there are no oter rpm files in the directory into which you download the files
    3. cd to the directory into which you downloaded the version 2.7-2 files
    4. Upgrade to the older packages: sudo rpm -Uvh --oldpackage *.rpm
    Note - there is a yum downgrade command, but I haven't used it.

    If your system doesn't object, you should be good to go. If you find there are other files you need, they should all be at the above url, just download them into the same directory.

    Suggested approach #2:
    Wipe Linpus and install a current, standard Linux-based OS.
     
    RockDoctor, May 23, 2010
    #7
  8. 7am3s

    madd0ct0r

    Joined:
    May 14, 2010
    Messages:
    8
    Likes Received:
    0
    to be honest, I'm kind of enjoying the challenge of getting Linpus up to scratch.

    in other words, I'm stoopid.

    I've an exam on wednesday, and I need this little lapdog until then (it's got my notes on it).

    Post that, I may well do as you suggest and clear the decks. The AA1 is a 2nd hand reseller, so no backup cd and no warranty either.

    nothing to really keep me tied to linpus.
    I'll stick with linux I think, it seems to do all that I need, some issues notwithstanding.

    EDIT:

    And thankyou very much for your help - saved me several more days of wasted effort. thankyou.
     
    madd0ct0r, May 24, 2010
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.