stroustrup - Programming -- Principles and Practice Using C++ - chapter 12

Discussion in 'C++' started by vase, Dec 14, 2009.

  1. vase

    vase New Member

    Joined:
    Dec 14, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I am learning C++ from the book of stroustrup: programming practice and principles using C++. I program on ubuntu 8.10 using the gcc compiler with the g++ script to compile c++ code. I fail to run the first example program of chapter 12 of this book (section 12.3, page 411), is is freely available on the website: stroustrup.com/Programming/, also the libs needed are available there.

    I compile the programming using this command:
    g++ -lfltk -lfltk_images -o 12_3 12_3.cpp -I ../lib -L../lib -lbookgui

    Compling goes fine, but if I run the program I get into trouble:
    *** glibc detected *** ./12-3: free(): invalid size: 0x00007fffb4bb4b50 ***
    ======= Backtrace: =========
    /lib/libc.so.6[0x7f29aba2fa58]
    /lib/libc.so.6(cfree+0x76)[0x7f29aba320a6]

    and so on...

    I was a bit surprised because I ran exactly the example given in the book, I get the same problems with other examples of this chapter, but not of previous chapters. Anyone a clue how I can trace this the cause of this memory problem?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Moved your attachment content into post
     
  3. Gene Poole

    Gene Poole New Member

    Joined:
    Nov 10, 2009
    Messages:
    93
    Likes Received:
    5
    Trophy Points:
    0
    I think maybe the libs provided by the book's website are compiled with a different version of glibc. If the source is available, try to compile the libs on your machine, then use those compiled libs instead of the pre-compiled libs provided.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice