I am trying to learn about classes for C++ but I keep running into a linker problem in which I get the following error message:
Undefined symbols for architecture x86_64: "Sally::printCrap()", referenced from: _main in cpp-c74cd5.o "Sally::Sally()", referenced
Here is the relevant code:
Code File #1: cpp.cpp
#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include "Sally.h"
using namespace std;
int main(){
Sally sallyObject;
sallyObject.printCrap();
}
Code File #2: Sally.cpp
#include "Sally.h"
#include <iostream>
using namespace std;
Sally::Sally()
{
}
void Sally::printCrap(){
cout << "hello" << endl;
}
Code File #3: Sally.h
#ifndef SALLY_H
#define SALLY_H
#pragma once
class Sally
{
public:
Sally();
void printCrap();
private:
};
#endif
I tried messing around with the syntax. Looked around and couldn't find any help that seemed related to my issue. Any help is greatly appreciated, I'm sure this type of issue is an easy fix.