Re: problems with g++ templates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bernhard,

The problem is you have forgotten to include the template functions in your testmain.cpp (or alternatively, in your testt.h).

#include "testt.h"
#include "testt.cpp"
#include <iostream>

main()
{
  TestT<double> w;
  w.setvalue( 2.0 );
  cout << w.getvalue( );
}

It's rather unconventional to put the template methods in a .cpp file. Usually they are put in the header file.

I have seen one convention that put template methods, template functions and inline functions in a .inl file, at one company I worked at.

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux