blossompark
asked on
Header Errors LNK2019, LNK1120 - Unresolved Externals
Hello all.
I'm trying to create a simple header and implement it in a cpp file, but I am experiencing the following error messages.
LNK2019 unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
LNK1120 1 unresolved externals
Here is the code for my header.
Here is the code for the cpp file I am trying to compile.
Both have been copied directly from a book, and try as I might I can't see any mistakes in my transcription.
Many thanks in advance!
I'm trying to create a simple header and implement it in a cpp file, but I am experiencing the following error messages.
LNK2019 unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
LNK1120 1 unresolved externals
Here is the code for my header.
#include <iostream>
class Cat
{
public:
Cat(int initialAge);
~Cat();
int GetAge() const { return itsAge; }
void SetAge (int age) { itsAge = age; }
void Meow() const { std::cout << "Meow.\n"; }
private:
int itsAge;
};
Here is the code for the cpp file I am trying to compile.
#include "Cat.h"
Cat::Cat(int initialAge)
{
itsAge = initialAge;
}
Cat::~Cat()
{
}
int main()
{
Cat Frisky(5);
Frisky.Meow();
std::cout << "Frisky is a cat who is " << Frisky.GetAge() << " years old.\n";
Frisky.Meow();
Frisky.SetAge(7);
std::cout << "Now Frisky is " << Frisky.GetAge() << " years old.\n";
return 0;
}
Both have been copied directly from a book, and try as I might I can't see any mistakes in my transcription.
Many thanks in advance!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER