templated class in microsoft visual c++ 7.0

From: John (selcon_at_yahoo.com)
Date: 10/30/03


Date: 30 Oct 2003 13:59:25 -0800

Hello,

I'm writing my first templated class in MS VC++, and I'm running into
some problems, hopefully someone could help.

I'm writing a templated class, with the class declarations in a .h
file, the class definitions (the methods) in a .cpp file, and the main
function (which uses the templated class) in another .cpp file.

I get a "Unresolved external symbol ......" error when I try to build
my project. However, if I shift the definitions from the .cpp file to
the header file, everything works.

Is there some VC++ issue where the definition codes must be in the
same file as the declaration?

Thanks!

John



Relevant Pages

  • Re: templated class in microsoft visual c++ 7.0
    ... > I'm writing a templated class, with the class declarations in a .h ... if I shift the definitions from the .cpp file to ...
    (alt.comp.lang.learn.c-cpp)
  • Re: templated function pointers?
    ... > I'm writing a templated class and would like to have a user definable ... > function to apply algorithmic modifiers. ... Something alone these lines: ...
    (comp.lang.cpp)