Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   stroustrup - Programming -- Principles and Practice Using C++ - chapter 12 (http://www.go4expert.com/forums/stroustrup-programming-principles-t20366/)

vase 14Dec2009 20:32

stroustrup - Programming -- Principles and Practice Using C++ - chapter 12
 
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?

shabbir 15Dec2009 09:32

Re: stroustrup - Programming -- Principles and Practice Using C++ - chapter 12
 
Moved your attachment content into post

Gene Poole 15Dec2009 19:47

Re: stroustrup - Programming -- Principles and Practice Using C++ - chapter 12
 
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.


All times are GMT +5.5. The time now is 19:16.