I have an unresolved external in Visual Studio C++ compiler that's driving me absolutely crackers. The class header and source files are extremely simple.
Header file:
// Header file: Rational.h
class Rational
{
public:
Rational ( int = 0, int = 1 );
private:
int numerator;
int denominator;
};
Source file:
// Source file: Rational.cpp
#include <iostream>
#include "Rational.h"
using namespace std;
Rational::Rational( int n, int d )
{
numerator = n;
denominator = d;
}
The error messages are:
error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
error LNK1120: 1 unresolved externals
How is this possible? I must be missing something very fundamental here but now I am at the end of my tether.
I have looked at other questions on this topic but can't find an answer.