Y
yichao.zhang
Hi all
when I wrote this 2 lines code in one file, it compiles fine.
template <class T> class A {};
class B: A<int> {};
however
when I put this code in one file,
template <class T> class A {};
this code in another file
template <class T> class A;
class B: A<int> {};
it complains that
M:\zz\clang>g++ tem.cpp tem2.cpp
tem2.cpp:3: base class `A<int>' has incomplete type
M:\zz\clang>g++ -v
Reading specs from D:/MinGW/bin/../lib/gcc-lib/mingw32/3.2.3/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld
--with-gnu-as --host=
mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls
--enable
-languages=c++,f77,objc --disable-win32-registry --disable-shared
--enable-sjlj-
exceptions
Thread model: win32
gcc version 3.2.3 (mingw special 20030504-1)
what does this mean? "base class `A<int>' has incomplete type"
any lights much appreciated!
when I wrote this 2 lines code in one file, it compiles fine.
template <class T> class A {};
class B: A<int> {};
however
when I put this code in one file,
template <class T> class A {};
this code in another file
template <class T> class A;
class B: A<int> {};
it complains that
M:\zz\clang>g++ tem.cpp tem2.cpp
tem2.cpp:3: base class `A<int>' has incomplete type
M:\zz\clang>g++ -v
Reading specs from D:/MinGW/bin/../lib/gcc-lib/mingw32/3.2.3/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld
--with-gnu-as --host=
mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls
--enable
-languages=c++,f77,objc --disable-win32-registry --disable-shared
--enable-sjlj-
exceptions
Thread model: win32
gcc version 3.2.3 (mingw special 20030504-1)
what does this mean? "base class `A<int>' has incomplete type"
any lights much appreciated!