using additional header and implementation files in a project with ‘header-imp-class’ configuration.

My project is making use of a C++ file in the main function. I also have a header that am using in declaring the class with its member functions and the fields. And with me is another regular function that is used in implementation of the class.
My focus is in making another header and implementation file in this project of mine. Am interested in the making of void functions which will go on and take the object that belong to the class that I created as an argument, then I call the this functions to the main.
In my second header that contains the definition, I must be missing something and hence am ending up with an error that point to the void function but I cannot understand anything at all that is in the message.
Below is the code that am doing. The code runs very well when it is in the main C++ file .


#ifndef HEADER_H
#define HEADER_H

#include "House.h"
void print_house_data(const House& house);

#endif

---------------IMPLEMENTION FILE OF THE VIOD FUNCTION------------

#include "Header.h"

#include<iostream>
using namespace std;

void print_house_data(const House& house) {

cout << "The house has " << house.getnumstories() << "stories, with " << house.getnumwindows() <<
"windows, and is the colour " << house.getcolor() << endl << endl;

}

---------ERROR MESSAGES------------

Severity Code Description Project File Line Suppression State

Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int classes true example C:\Users\User\Desktop\saved cpp files\classes true example\classes true example\Header.h 5

Error C2143 syntax error: missing ',' before '&' classes true example C:\Users\User\Desktop\saved cpp files\classes true example\classes true example\Header.h 5

Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int classes true example C:\Users\User\Desktop\saved cpp files\classes true example\classes true example\Header.h 5

Error C2143 syntax error: missing ',' before '&' classes true example C:\Users\User\Desktop\saved cpp files\classes true example\classes true example\Header.h 5
Last edited on
> Header.h 5
Since line 4 would seem to be
#include "House.h"
having a look in there is probably a good place to look.

A good one is missing the trailing ; off the end of your class.
Topic archived. No new replies allowed.