Chapter 11. Known Causes of Trouble with GCC 29111.9. Common Misunderstandings with GNU C++C++ is a complex language and an evolving one, and its standard definition (the ISO C++ standard)was only recently completed. As a result, your C++ compiler may occasionally surprise you, evenwhen its behavior is correct. This section discusses some areas that frequently give rise to questionsof this sort.11.9.1. Declare andDefine Static MembersWhen a class has static data members, it is not enough to declare the static member; you must alsodefine it. For example:class Foo{...void method();static int bar;};This declaration only establishes that the class Foo has an int named Foo::bar, and a member func-tion named Foo::method. But you still need to define both method and bar elsewhere. Accordingto the ISO standard, you must supply an initializer in one (and only one) source file, such as:int Foo::bar = 0;Other C++ compilers may not correctly implement the standard behavior. As a result, when you switchto g++ from one of these compilers, you may discover that a program that appeared to work correctlyin fact does not conform to the standard: g++ reports as undefined symbols any static data membersthat lack definitions.11.9.2. Name lookup, templates, and accessing members of base classesThe C++ standard prescribes that all names that are not dependent on template parameters are boundto their present definitions when parsing a template function or class.1 Only names that are dependentare looked up at the point of instantiation. For example, considervoid foo(double);struct A {template K typename TLvoid f () {foo (1); // 1int i = N; // 2T t;t.bar(); // 3foo (t); // 4}static const int N;};1. The C++ standard just uses the term "dependent" for names that depend on the type or value of templateparameters. This shorter term will also be used in the rest of this section.