sine.cpp isn't run good on gnu/g++, plz help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Steve Oualline:
  the book (Practical C++ Programming), AppendixD
computing sine using a power series
the program you listed on page 525, Example D-2 sin/sine.cpp
I tested on my linux/gnu-g++
----------------
eric@eric-laptop:~/practicalCpp/sin$ ./sine 3.141
x**1     3.141E+00
1!       1.000E+00
x**1/1! 3.141E+00
  total   3.141E+00

x**3     3.099E+01
3!       6.000E+00
x**3/3! 5.165E+00
*** stack smashing detected ***: ./sine terminated
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x50)[0x3d8390]
/lib/tls/i686/cmov/libc.so.6(+0xe233a)[0x3d833a]
./sine[0x8048e11]
./sine[0x8048bb5]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x30cbd6]
./sine[0x80488b1]
======= Memory map: ========
00110000-00134000 r-xp 00000000 08:01
8913271    /lib/tls/i686/cmov/libm-2.11.1.so
00134000-00135000 r--p 00023000 08:01
8913271    /lib/tls/i686/cmov/libm-2.11.1.so
00135000-00136000 rw-p 00024000 08:01
8913271    /lib/tls/i686/cmov/libm-2.11.1.so
0025b000-00276000 r-xp 00000000 08:01 8913086    /lib/ld-2.11.1.so
00276000-00277000 r--p 0001a000 08:01 8913086    /lib/ld-2.11.1.so
00277000-00278000 rw-p 0001b000 08:01 8913086    /lib/ld-2.11.1.so
002d7000-002f4000 r-xp 00000000 08:01 8912979    /lib/libgcc_s.so.1
002f4000-002f5000 r--p 0001c000 08:01 8912979    /lib/libgcc_s.so.1
002f5000-002f6000 rw-p 0001d000 08:01 8912979    /lib/libgcc_s.so.1
002f6000-00449000 r-xp 00000000 08:01
8913215    /lib/tls/i686/cmov/libc-2.11.1.so
00449000-0044a000 ---p 00153000 08:01
8913215    /lib/tls/i686/cmov/libc-2.11.1.so
0044a000-0044c000 r--p 00153000 08:01
8913215    /lib/tls/i686/cmov/libc-2.11.1.so
0044c000-0044d000 rw-p 00155000 08:01
8913215    /lib/tls/i686/cmov/libc-2.11.1.so
0044d000-00450000 rw-p 00000000 00:00 0 
00988000-00989000 r-xp 00000000 00:00 0          [vdso]
0099a000-00a83000 r-xp 00000000 08:01 12062387   /usr/lib/libstdc
++.so.6.0.13
00a83000-00a84000 ---p 000e9000 08:01 12062387   /usr/lib/libstdc
++.so.6.0.13
00a84000-00a88000 r--p 000e9000 08:01 12062387   /usr/lib/libstdc
++.so.6.0.13
00a88000-00a89000 rw-p 000ed000 08:01 12062387   /usr/lib/libstdc
++.so.6.0.13
00a89000-00a90000 rw-p 00000000 00:00 0 
08048000-0804a000 r-xp 00000000 08:01
5507048    /home/eric/practicalCpp/sin/sine
0804a000-0804b000 r--p 00001000 08:01
5507048    /home/eric/practicalCpp/sin/sine
0804b000-0804c000 rw-p 00002000 08:01
5507048    /home/eric/practicalCpp/sin/sine
08b07000-08b28000 rw-p 00000000 00:00 0          [heap]
b78bf000-b78c1000 rw-p 00000000 00:00 0 
b78d5000-b78d8000 rw-p 00000000 00:00 0 
bfc8f000-bfca4000 rw-p 00000000 00:00 0          [stack]
Aborted
eric@eric-laptop:~/practicalCpp/sin$ 
-------------------------------------------
that certainly is not what your book predict on page 523
plz help, Eric, US citizen



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux