This is the forum to discuss the Wrox book Professional C++, 2nd Edition by Marc Gregoire, Nicholas A. Solter, Scott J. Kleper ; ISBN: 978-1-1181-6995-7
You are currently viewing the BOOK: Professional C++, 2nd Edition section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
On page 181 is the following code from Spreadsheet.h:
static int sCounter = 0;
Using GCC Ver 4.9.2 I get the following error message:
Error: "Spreadsheet.h|34|error: ISO C++ forbids in-class initialization of non-const static member ‘Spreadsheet::sCounter’|"
This is the only code I've found in this book that doesn't compile on this compiler (set to conform to "C++ 11 ISO C++ language standards.") Anyone know why this is happening?
Thanks for replying. Just as a suggestion, perhaps the proper code could be added to the errata page. I'm assuming the proper course is to use your non-C++ 11 coding instructions in the book.