I keep getting this problem. After learning about inheritance and understanding classes and constructors I can't see why this is happening. In a lab for school I made three classes connecting them with inheritance. While testing my three default constructors and general ones, Xcode is basically saying it doesn't see my constructors. To keep the question short this is one of my three classes. I'm working on Xcode version 7.2 practicing C++.
I've searched far and wide on the internet. This isn't an exact duplicate of anything. If I found my answer I would spend this time posting this.
#ifndef Point2D_h
#define Point2D_h
#include<iostream>
using namespace std;
class Point2D{
private:
int x;
int y;
public:
Point2D();
Point2D(int xx, int yy):x(xx),y(yy){}
int getX(){ return x;};
int getY(){ return y;};
void setX(int newX){ x = newX;}
void sety(int newY){ y = newY;}
void Print(){ cout << x <<" " << y;}
bool Equal(Point2D);
};
#endif /* Point2D_h */
-------------------Main------------------------
#include <iostream>
#include "Point2D.h"
#include "Circle.h"
#include "Cylinder.h"
#include "Point2D_Functions.cpp"
#include "Cylinder_Functions.cpp"
#include "Standard_Functions.cpp"
using namespace std;
int main(){
Point2D p1;
return 0;
}
ERRORS:
1) Point2D::Point2D()
, referenced from:
2) Linker command failed withe exit code 1(use -v to see invocation)
When testing the other default constructors like Circle
or Cylinder
, I get
the same error just with the different name in the error like Circle::Circle()
...