Hello, I am at tutorial number 44 in "Bucky's c++ programming tutorials" - const objects and There is an error that I can't figure out.
-------------------------------
Main.cpp:
#include "Sally.h"
#include <iostream>
using namespace std;
int main()
{
Sally salObj;
salObj.printShiz();
const Sally constObj;
constObj.printShiz2();
}
-------------------------------
Sally.h:
#ifndef SALLY_H
#define SALLY_H
class Sally
{
public:
Sally();
void printShiz();
void printShiz2() const;
protected:
private:
};
#endif // SALLY_H
-------------------------------
Sally.cpp:
#include "Sally.h"
#include <iostream>
using namespace std;
Sally::Sally(){
}
void Sally::printShiz(){
cout << " I am a regular function" << endl;
}
void Sally::printShiz2() const{
cout << "I am the constant function" << endl;
}
-------------------------------
As far as I can tell my code is exactly the same as his, but I keep getting this error whenever I try to run ANYTHING with a class in a seperate file.
undefined reference to Sally::Sally
undefined reference to Sally::printShiz
undefined reference to Sally::Sally
undefined reference to Sally::printShiz2() const
Also, they are all in the same project file and same folder on my desktop.