Hi Folks, I ran into a problem while building an old project with gcc 4.1.2. In object file, I could not find the expected symbol for template function. Here is an example program: ======== test.hpp ======== class T { public: T() {}; ~T() {}; }; template <class MyT> class test { public: int ftest(); }; ======== test.cpp ======== #include <test.hpp> template class test<T>; template <class MyT> int test<MyT>::ftest() { return 0; } I ran the command gcc -c -I. -o test.o test.cpp to compile test.cpp. In the object file "test.o", I could not find the symbol name "ftest" if I compiled test.cpp with gcc 4.1.2. > gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.2 20080704 (Red Hat 4.1.2-44) > gcc -c -I. -W -Wall -Wextra -o test.o test.cpp > nm test.o <Nothing listed here> If we compiled test.cpp with gcc 3.4.6, we could see the symbols as expected: > gcc -v Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux Thread model: posix gcc version 3.4.6 20060404 (Red Hat 3.4.6-3) > gcc -c -I. -W -Wall -Wextra -o test.o test.cpp > nm test.o U __gxx_personality_v0 0000000000000000 W _ZN4testI1TE5ftestEv We can see the function "ftest" is defined in this object file. This problem has troubled me for a few days. Could you please give some helps to help me understand why the symbols "ftest" cannot be found if we compiled test.cpp with gcc 4.1.2? Are there any available options to work around this? Thanks for all your kindly helps in advance. Thanks again. Best Regards Jian-ping -- View this message in context: http://www.nabble.com/Template-function-is-not-found-in-object-file-after-compiling-with-gcc-4.1.2%E2%80%8F-tp25658965p25658965.html Sent from the gcc - Help mailing list archive at Nabble.com.