LNK 2019 and LNK 1120 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

LNK 2019 and LNK 1120

dww1g11dww1g11 Posts: 1Member
I am new to c++ and am using visual 2010. I'm trying to get to grips with templates and have compiled the following code

1 #include "stdafx.h"
2
3 template
4 class Vcr {
5 int length; // number of entries
6 T* vr; // entries of vector
7 public:
8 template friend class Vcr;
9 Vcr(int, const T* const); // constructor
10 Vcr(int = 0, T = 0); // constructor
11 Vcr(const Vcr&); // copy of constructor
12 ~Vcr(){ delete[] vr;} // destructor
13
14 int size() const { return length; } // number of entries
15 Vcr& operator=(const Vcr&); // assignment
16 T& operator[](int i) { return vr[i]; } // subscripting
17 Vcr& operator+=(const Vcr&); // v += v2
18 T maxnorm() const; // maximum norm
19
20 template // dot product
21 friend S dot(const Vcr&, const Vcr&);
22
23 };
24
25 int _tmain(int argc, _TCHAR* argv[]) {
26
27 Vcr (20);
28 return 0;
29 }

When I build the code I get the following error messages

: error LNK2019: unresolved external symbol "public: __thiscall Vcr::Vcr(int,double)" (??0?$Vcr@N@@QAE@HN@Z) referenced in function _wmain

: fatal error LNK1120: 1 unresolved externals


Any help would be appreciated.
Sign In or Register to comment.