@└────> # g++ main.cc -c @└────> # g++ A.cc -c @└────> # nm main.o 0000000000000000 T main U _ZN1A5printEv @└────> # nm A.o U __cxa_atexit U __dso_handle 000000000000006c t _GLOBAL__sub_I__ZN1A5printEv 000000000000002e t _Z41__static_initialization_and_destruction_0ii 0000000000000000 T _ZN1A5printEv U _ZNSolsEi U _ZNSolsEPFRSoS_E U _ZNSt8ios_base4InitC1Ev U _ZNSt8ios_base4InitD1Ev U _ZSt4cout U _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_ 0000000000000000 r _ZStL19piecewise_construct 0000000000000000 b _ZStL8__ioinit
@└────> # g++ main.cc -c @└────> # g++ A.cc -c @└────> # nm main.o 0000000000000000 T main U _ZN1A5printIiEEvv @└────> # nm A.o U __cxa_atexit U __dso_handle 000000000000003e t _GLOBAL__sub_I_A.cc 0000000000000000 t _Z41__static_initialization_and_destruction_0ii U _ZNSt8ios_base4InitC1Ev U _ZNSt8ios_base4InitD1Ev 0000000000000000 r _ZStL19piecewise_construct 0000000000000000 b _ZStL8__ioinit
#include<iostream> classA { public: int m; template<class T> voidprint(){ std::cout << m << std::endl; } };
编译:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
@└────> # g++ main.cc -c @└────> # nm main.o U __cxa_atexit U __dso_handle 0000000000000059 t _GLOBAL__sub_I_main 0000000000000000 T main 000000000000001b t _Z41__static_initialization_and_destruction_0ii 0000000000000000 W _ZN1A5printIiEEvv U _ZNSolsEi U _ZNSolsEPFRSoS_E U _ZNSt8ios_base4InitC1Ev U _ZNSt8ios_base4InitD1Ev U _ZSt4cout U _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_ 0000000000000000 r _ZStL19piecewise_construct 0000000000000000 b _ZStL8__ioinit