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.