Errors LNK2028 and LNK2019

I do not understand why my program won't work because of numerous LNK2028 and LNK2019 errors. I am using Microsoft Visual Studio Express 2012. 3 files make up this program. Any help is greatly appreciated! (I have weird names because I have made many copies....)

Here are my files:

Header take 2.h:

#pragma once
#include <iostream>
#include <string>
using namespace std;

class Heading
{
private:
string company, report;

public:
//Default constructor
Heading(void);
//Constructor
Heading(string company, string report);
//set and display company and report name
void setCompany(string c);
void setReport(string r);
void displayBoxed();
void displayOneLine();
};


heading take 2.cpp:

#include "header take 2.h"

//Default constructor
Heading::Heading(void)
company = report = " ";

//Constructor
Heading::Heading(string company, string report)
{
company = "ABC Industries";
report = "Report";
}
//Heading:setCompany
void Heading::setCompany(string c)
{
company = c;
}
//Heading::setReport
void Heading::setReport(string r)
{
report = r;
}
//Heading::displayBoxed
void Heading::displayBoxed()
{
cout << company << endl;
cout << report << endl;
}
//Heading::displayOneLine
void Heading::displayOneLine()
cout << company << report << endl;


Source1. cpp [main]:
#include <iostream>
using namespace std;

#include "header take 2.h"

int main()
{
string company;
string report;

cout << "Please enter the company name: ";
cin >> company;

cout << "Please enter the report name: ";
cin >> report;

Heading hdg;

hdg.setCompany(company);
hdg.setReport(report);
hdg.displayBoxed();
hdg.displayOneLine();

return 0;
}
1) Please use code tags to make your code more readable

2) How can we help you if you won't tell us what these errors are?
Here are my errors:

Error 1 error LNK2028: unresolved token (0A0003C9) "public: __thiscall Heading::Heading(void)" (??0Heading@@$$FQAE@XZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ) c:\Users\Owner\documents\visual studio 2012\Projects\ClassLibrary2\ClassLibrary2\Source1.obj ClassLibrary2

Error 2 error LNK2028: unresolved token (0A0003CA) "public: void __thiscall Heading::setCompany(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?setCompany@Heading@@$$FQAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ) c:\Users\Owner\documents\visual studio 2012\Projects\ClassLibrary2\ClassLibrary2\Source1.obj ClassLibrary2

Error 3 error LNK2028: unresolved token (0A0003CB) "public: void __thiscall Heading::setReport(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?setReport@Heading@@$$FQAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ) c:\Users\Owner\documents\visual studio
2012\Projects\ClassLibrary2\ClassLibrary2\Source1.obj ClassLibrary2

Error 4 error LNK2028: unresolved token (0A0003CC) "public: void __thiscall Heading::displayBoxed(void)" (?displayBoxed@Heading@@$$FQAEXXZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ) c:\Users\Owner\documents\visual studio 2012\Projects\ClassLibrary2\ClassLibrary2\Source1.obj ClassLibrary2

Error 5 error LNK2028: unresolved token (0A0003CD) "public: void __thiscall Heading::displayOneLine(void)" (?displayOneLine@Heading@@$$FQAEXXZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ) c:\Users\Owner\documents\visual studio 2012\Projects\ClassLibrary2\ClassLibrary2\Source1.obj ClassLibrary2

Error 6 error LNK2019: unresolved external symbol "public: __thiscall Heading::Heading(void)" (??0Heading@@$$FQAE@XZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ) c:\Users\Owner\documents\visual studio 2012\Projects\ClassLibrary2\ClassLibrary2\Source1.obj ClassLibrary2

Error 7 error LNK2019: unresolved external symbol "public: void __thiscall Heading::setCompany(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?setCompany@Heading@@$$FQAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ) c:\Users\Owner\documents\visual studio 2012\Projects\ClassLibrary2\ClassLibrary2\Source1.obj ClassLibrary2

Error 8 error LNK2019: unresolved external symbol "public: void __thiscall Heading::setReport(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?setReport@Heading@@$$FQAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ) c:\Users\Owner\documents\visual studio 2012\Projects\ClassLibrary2\ClassLibrary2\Source1.obj ClassLibrary2

Error 9 error LNK2019: unresolved external symbol "public: void __thiscall Heading::displayBoxed(void)" (?displayBoxed@Heading@@$$FQAEXXZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ) c:\Users\Owner\documents\visual studio 2012\Projects\ClassLibrary2\ClassLibrary2\Source1.obj ClassLibrary2

Error 10 error LNK2019: unresolved external symbol "public: void __thiscall Heading::displayOneLine(void)" (?displayOneLine@Heading@@$$FQAEXXZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ) c:\Users\Owner\documents\visual studio 2012\Projects\ClassLibrary2\ClassLibrary2\Source1.obj ClassLibrary2

Error 11 error LNK1120: 10 unresolved externals c:\users\owner\documents\visual studio 2012\Projects\ClassLibrary2\Debug\ClassLibrary2.dll ClassLibrary2
Here it is with code tags:

1
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
Header take 2.h:

#pragma once
#include <iostream>
#include <string>
using namespace std;

class Heading
{
private:
string company, report;

public:
//Default constructor
Heading(void);
//Constructor
Heading(string company, string report);
//set and display company and report name
void setCompany(string c);
void setReport(string r);
void displayBoxed();
void displayOneLine();
};


heading take 2.cpp:

#include "header take 2.h"

//Default constructor
Heading::Heading(void)
company = report = " ";

//Constructor
Heading::Heading(string company, string report)
{
company = "ABC Industries";
report = "Report";
}
//Heading:setCompany
void Heading::setCompany(string c)
{
company = c;
}
//Heading::setReport
void Heading::setReport(string r)
{
report = r;
}
//Heading::displayBoxed
void Heading::displayBoxed()
{
cout << company << endl;
cout << report << endl;
}
//Heading::displayOneLine
void Heading::displayOneLine()
cout << company << report << endl;


Source1. cpp [main]:
#include <iostream>
using namespace std;

#include "header take 2.h"

int main()
{
string company;
string report;

cout << "Please enter the company name: ";
cin >> company;

cout << "Please enter the report name: ";
cin >> report;

Heading hdg;

hdg.setCompany(company);
hdg.setReport(report);
hdg.displayBoxed();
hdg.displayOneLine();

return 0;
}
Topic archived. No new replies allowed.