Linker Error Undefined Reference To Template
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions undefined reference to template member function you might have Meta Discuss the workings and policies of c++ undefined reference to template class method this site About Us Learn more about Stack Overflow the company Business Learn more about hiring
Undefined Reference To Template Class Constructor
developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a
C++ Template Function Undefined Reference
community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Undefined reference error for template method up vote 31 down vote favorite 7 This has been driving me mad for the past hour and a half. I know it's a small thing but extern template cannot find what's wrong (the fact that it's a rainy Friday afternoon, of course, does not help). I have defined the following class that will hold configuration parameters read from a file and will let me access them from my program: class VAConfig { friend std::ostream& operator<<( std::ostream& lhs, const VAConfig& rhs); private: VAConfig(); static std::string configFilename; static VAConfig* pConfigInstance; static TiXmlDocument* pXmlDoc; std::map
here for a quick overview of the site Help Center Detailed answers to any questions
Template Class Implementation In Cpp File
you might have Meta Discuss the workings and policies of this c++ template instantiation site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers template class c++ or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a http://stackoverflow.com/questions/1111440/undefined-reference-error-for-template-method community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up “Undefined reference to” template class constructor [duplicate] up vote 73 down vote favorite 66 This question already has an answer here: Why can templates only be implemented in the header file? 12 answers http://stackoverflow.com/questions/8752837/undefined-reference-to-template-class-constructor I have no idea why this is happenning, since I think I have everything properly declared and defined. I have the following program, designed with templates. It's a simple implementation of a queue, with the member functions "add", "substract" and "print". I have defined the node for the queue in the fine "nodo_colaypila.h": #ifndef NODO_COLAYPILA_H #define NODO_COLAYPILA_H #include for a doubly linked list. The linked list class takes a template parameter. I'm hitting the following linker error when building my programs: /tmp/cc1tFbiv.o: In undefined reference function `main': main.cpp:(.text+0x42): undefined reference to `DoublyLinkedList error] undefined reference to 'getGrossPay(double)' [Linker error] undefined reference to 'getStateTax(double)' [Linker error] undefined reference to 'getFederalTax(double)' [Linker error] undefined reference to 'getFICA(double)' [Linker error] undefined reference to 'getWithHoldingAmount(double)' I have been trying to debug this error for hours and I am completely stumped.... //BEGIN #include
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
[dList.h] #ifndef __DOUBLY_LINKED_LIST__ #define __DOUBLY_LINKED_LIST__ #include