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

vase's Avatar, Join Date: Dec 2009
Newbie Member
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:, 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: =========

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?
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Moved your attachment content into post
Gene Poole's Avatar, Join Date: Nov 2009
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.