Does anyone know how to fix this error? All I have is a header file and a source file for a class.
1>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
#ifndef POINT_H
#define POINT_H
#include
class Point {
public:
Point();
Point(unsigned int x, unsigned int y);
bool operator== (const Point &other) const;
unsigned int m_x;
unsigned int m_y;
friend std::ostream& operator<<(std::ostream &sout, const Point &pt);
};
#endif
AND
#include "Point.h"
Point::Point() {} // Needed because of existence of other constructors
Point::Point(unsigned int x, unsigned int y) {
m_x = x;
m_y = y;
}
// Note: automatically get copy constructor
bool
Point::operator== (const Point &other) const {
return (m_x == other.m_x && m_y == other.m_y);
}
std::ostream& operator<<(std::ostream &sout, const Point &pt) {
sout << "(" << pt.m_x << ", " << pt.m_y << ")";
return sout;
}
No comments:
Post a Comment