C ++ common Undefined symbols for architecture * And undefinedsymbols
Appears
Undefined symbols for architecture x86_64:
Cause
1. The function is declared, but not defined.
2. The declared virtual function is not implemented.
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
3. Use template <class T> to implement the class. If you write the function declaration in A. H file, write it in. cpp. The Undefined symbols for architecture x86_64 is displayed. Declarations and implementations should be placed in. H files
Template <class T> class Heap {typedef typename vector <T>: iterator; private: vector <T> container; void swim (int I ); void sink (int I) ;}; template <class T> void Heap <T >:: swim (int I) {while (I> 1 & container [I]> container [I/2]) {T temp = container [I]; container [I] = container [I/2]; container [I/2] = temp; I = I/2 ;}}
Http://www.cnblogs.com/like1/p/6848669.html