I have that common LNK2019 error and can not figure out what is wrong.
Here is my Solution Explorer:
Here is my Rectangle.cpp
:
class Rectangle
{
public:
int getArea()
{
return this->width*this->height;
}
int width;
int height;
};
Here is my Rectangle.h
:
#pragma once
class Rectangle
{
public:
int getArea();
int width;
int height;
};
Here is my Functions.cpp
:
#include <iostream>
#include "Rectangle.h";
using namespace std;
int main()
{
Rectangle r3{ 2, 3 };
cout << r3.getArea();
return 0;
}
I am very new to C++ and it seems I did everything correctly, but still I am getting an error.