Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7044367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:24:05+00:00 2026-05-28T02:24:05+00:00

I do not understand the error in compilation. I don’t see any syntax problems.

  • 0

I do not understand the error in compilation. I don’t see any syntax problems.

Errors:

/dev/shm/ccEF5pIa.o: In function `main':
fig03_13.cc:(.text+0x45): undefined reference to `GradeBook::GradeBook(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
fig03_13.cc:(.text+0x9d): undefined reference to `GradeBook::GradeBook(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
fig03_13.cc:(.text+0xce): undefined reference to `GradeBook::getCourseName()'
fig03_13.cc:(.text+0xe1): undefined reference to `GradeBook::getCourseName()'
collect2: ld returned 1 exit status

GradeBook.cc:21:8: error: prototype for 'std::string GradeBook::displayMessage()' does not match any in class 'GradeBook'
GradeBook.h:15:8: error: candidate is: void GradeBook::displayMessage()

This is GradeBook.h

#include <string> // class GradeBook uses C++ standard string class
using namespace std;

// GradeBook class definition
class GradeBook
{
    public:
            GradeBook(string); // constructor that initializes courseName
            void setCourseName(string); // function that sets the course name
            string getCourseName(); // function that gets the course name
            void displayMessage(); // function that displays a welcome message
    private:
            string courseName; // course name for this GradeBook
};

GradeBook.cc

#include <iostream>
#include "GradeBook.h" // include definition of class GradeBook
using namespace std;

// constructor initializes courseName with string supplied as argument
GradeBook::GradeBook(string name)
{
    setCourseName(name); // call set function to initialize courseName
} // end GradeBook constructor

// function to set the course name
void GradeBook::setCourseName(string name)
{
    courseName = name; // store the course name in the object
} // end function setCourseName

// function to get the course name
string GradeBook::displayMessage()
{
    // call getCourseName to get the courseName
    cout << "welcome to the grade book for\n" << getCourseName() << "!" << endl;
} // end function displayMessage

fig03_13.cc

#include <iostream>
#include "GradeBook.h" // include definition of class GradeBook
using namespace std;

// function main begins program execution
int main() {
    // create two  GradeBook objects
    GradeBook gradeBook1("CS101 Introduction to C++ Programming");
    GradeBook gradeBook2("CS102 Data Structures in C++");

    // display initial value of courseName for each GradeBook
    cout << "gradeBook1 created for course: " << gradeBook1.getCourseName()
       << "\ngradeBook2 created for course: " << gradeBook2.getCourseName() << endl;
} // end main
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:24:06+00:00Added an answer on May 28, 2026 at 2:24 am

    Definition: string GradeBook::displayMessage().

    Declaration: void displayMessage()

    You don’t need to return string. Just keep the void edition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's how I understand asp.net compilation. Please correct any errors in my understanding. If
I do not understand this error, do not generate error in JsonResult Test (),
I am getting an error I do not understand. I am using File:Find to
I have encountered a rather odd error that I do not understand. I created
All time am getting below error message in groovy... Could not understand whats causing
I do not understand pointers. Where can I learn more about them?
I simply do not understand why both works: this.timer.Tick += new EventHandler(timer_Tick); this.timer.Tick +=
I do not understand what environment a eval or exec statement executes in. You
I do not understand how to use enumeration types. I understand what they are,
I do not understand why the dialog will not work for width in Firefox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.