I'm new to C++ and and I've been trying to solve this problem. I've copied it form a book and I'm using code-blocks and my IDE but I don't understand why this is not working. I have looked around for answers and somebody said
undefined reference error, usually it's because the .o file (which gets created from the .cpp file) doesn't exist
But when I checked the files it was there. If someone could help it would be greatly appreciated. I also think that part of the problem could be something to do with the binary scope resolution operator. Here's my code:
    **gradebook.h**
    #include <string>
    using namespace std;
    class gradebook
    {
    public:
    gradebook ( string );
    void setcourseName( string );
    string getcourseName();
    void displayMessage();
    private:
    string courseName;
    };//end gradebook.h
    **gradebook.cpp**
    #include <iostream>
    #include "gradebook.h"
    using namespace std;
    gradebook::gradebook(string name){
    setcourseName(name);
    }
    void gradebook::setcourseName(string name){
    courseName = name;
    }
    string gradebook::getcouseName(){
    return courseName;
    }
    void gradebook::displayMessage(){
    cout<<"welcome to the grade book for\n" << getcourseName()<<"!"<<endl;                  
    }//end gradebook.cpp 
    **main.cpp**
    #include <iostream>
    #include "gradebook.h"
    using namespace std;
    int main()
    {
    gradebook gradebook1("CS101 introduction to c++ programing");
    gradebook gradebook2("CS102 data structures in c++");
    cout<< "gradebook1 created for course:" << gradebook1.getcourseName()
    << "\n gradebook2 created for course:" <<gradebook2.getcourseName()
    << endl;
    }//end main.cpp
The errors I keep getting back are main.cpp undefined reference to gradebook::getcourseName() and main.cpp undefined reference to gradebook::gradebook(std::string).
What causes the error?
 
     
    