Just getting started

This is a discussion on Just getting started within the C++ Programming forums, part of the General Programming Boards category; My question is, I purchased the Jumping into C++ book last night, and I go to the sample source code ...

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    2

    Just getting started

    My question is, I purchased the Jumping into C++ book last night,
    and I go to the sample source code hello.cpp, use nano to open save, the g++ compiler code compiles, fine ex.. "g++ hello.cpp -o hello.

    No errors.
    But when I try to run by using g++ ./hello I get this >

    "./hello: In function `_start':
    (.text+0x0): multiple definition of `_start'
    /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crt1.o.text+0x0): first defined here
    ./hello.rodata+0x0): multiple definition of `_fp_hw'
    /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crt1.o.rodata+0x0): first defined here
    ./hello: In function `_fini':
    (.fini+0x0): multiple definition of `_fini'
    /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crti.o.fini+0x0): first defined here
    ./hello.rodata+0x4): multiple definition of `_IO_stdin_used'
    /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crt1.o.rodata.cst4+0x0): first defined here
    ./hello: In function `__data_start':
    (.data+0x0): multiple definition of `__data_start'
    /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crt1.o.data+0x0): first defined here
    ./hello: In function `__data_start':
    (.data+0x4): multiple definition of `__dso_handle'
    /usr/lib/gcc/i686-linux-gnu/4.6.1/crtbegin.o.data+0x0): first defined here
    ./hello: In function `_init':
    (.init+0x0): multiple definition of `_init'
    /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crti.o.init+0x0): first defined here
    /usr/lib/gcc/i686-linux-gnu/4.6.1/crtend.o.dtors+0x0): multiple definition of `__DTOR_END__'
    ./hello.dtors+0x4): first defined here
    /usr/bin/ld: error in ./hello(.eh_frame); no .eh_frame_hdr table will be created.
    collect2: ld returned 1 exit status "

    But when I view source code in geany and compile, same no errors, when I build and run, it works.

    Question is Whats the problem?

    Thanks in advance.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    > and I go to the sample source code hello.cpp, use nano to open save, the g++ compiler code compiles, fine ex.. "g++ hello.cpp -o hello.

    > But when I try to run by using g++ ./hello I get this >
    Because to RUN the program, you just type
    ./hello

    You're trying to compile it again!
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Apr 2012
    Posts
    2
    Ok thanks, I've must have miss this, because I have run the program before the other day, must slow down.

    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. When you started
    By xInfested in forum C++ Programming
    Replies: 3
    Last Post: 02-18-2008, 02:26 AM
  2. Started over please help.
    By silhoutte75 in forum C Programming
    Replies: 14
    Last Post: 02-11-2008, 11:59 PM
  3. Getting Started
    By bumfluff in forum Windows Programming
    Replies: 1
    Last Post: 11-12-2005, 10:44 AM
  4. just started
    By vivek_kumbhar in forum C Programming
    Replies: 3
    Last Post: 07-07-2003, 04:25 PM
  5. Getting started
    By SMB3Master in forum Windows Programming
    Replies: 3
    Last Post: 05-29-2003, 05:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21