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 8817307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:48:53+00:00 2026-06-14T04:48:53+00:00

—UPDATED — I have problems when including headers and cpp files in my project,

  • 0

—UPDATED —

I have problems when including headers and cpp files in my project, so here are the files:
Person.h

#ifndef PERSON_H
#define PERSON_H

class Person {
private:
string firstName;
string lastName;
long NID;

public:
Person();
void toString();

string get_firstName() {
    return firstName;
}

string get_lastName() {
    return lastName;
}

long get_NID() {
    return NID;
}
};

#endif

Teacher which extends Person
Teacher.h

#include "Person.h"
#include <iostream>

#ifndef TEACHER_H
#define TEACHER_H

class Teacher : public Person {
private:
int avg_horarium;

public:
Teacher();
void toString();

int get_avg_horarium() {
    return avg_horarium;
}
};

#endif

Then here is Teacher.cpp:

#include "Teacher.h"
using namespace std;

Teacher::Teacher() : Person() {
cout << "Enter average monthly horarium: ";
cin >> avg_horarium;
}

void Teacher::toString() {
Person::toString();
cout << "Average monthly horarium: " << avg_horarium;
}

The other class which extends Person is Student and since it’s similar to teacher i won’t poste it here. My question is what am i doing wrong to get all these errors on the screenshot:
http://s14.postimage.org/45k08ckb3/errors.jpg

  • 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-06-14T04:48:54+00:00Added an answer on June 14, 2026 at 4:48 am

    The problem is your incorrect treatment of stdafx.h file. In MSVC compilers, when precompiled headers are enabled, everything before #include "stdafx.h" line is ignored.

    Firstly, stop including stdafx.h into header (.h) files. stdafx.h is supposed to be included into implementation (.cpp) files. In your case, #include "stdafx.h" should be placed into Person.cpp and Teacher.cpp, not into Person.h and Teacher.h.

    Secondly, either disable precompiled headers in your project, or make sure that #include "stdafx.h" is always the very first meaningful line in each of your implementation files. All other #include directives should go after #include "stdafx.h", not before.

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

Sidebar

Related Questions

So to start, I have an array of XML files. These files need to
I'm including a local class that requests a file from a remote server. This
This is an interesting problem that I have searched here and all over my
I have set of xml elements like this: <item code=<HTML_CODE> /> For example: <items>
I basically have the classic many to many model. A user, an award, and
&mdash; or &#8212; Is there a difference between these? Is one better-supported than the
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm using a DatePicker ( org.apache.wicket.extensions.yui.calendar.DatePicker — Javadoc ) in a form. The form
Using the titleFormat I have: $calendar.fullCalendar({ titleFormat: { month: 'MMMM yyyy', // September 2009
I have a fairly mundane piece jQuery that toggles a div's visibility when a

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.