0

So, the issue is in the main driver .cpp file. It references the houseClassType as the problem, but I am not sure what needs to be done to resolve it. Any help would be awesome.

Standards header file:

#ifndef Standards_h
#define Standards_h
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>

using namespace std;

#endif

Standards .cpp file:

#include "Standards.h"

Realtor header file:

#include "Standards.h"
#include "house.h"

#ifndef Realtor_h
#define Realtor_h

const int NUMBER_OF_HOMES = 30;

struct realtorStructType
{
    int numberOfHomes;

    string agentName;

    houseClassType homes[NUMBER_OF_HOMES];
};

void InputHomes(ifstream& fin, string agentName, 
houseClassType homes[], int& numberOfHomes);


#endif

Realtor .cpp file:

#include "Standards.h"
#include "Realtor.h"
#include "house.h"

void InputHomes(ifstream& fin, string agentName, houseClassType    
                homes[], int& numberOfHomes)
{
    getline(fin, agentName);
}

House header file:

#include "Standards.h"

#ifndef house_h
#define house_h

//Definition of class, house
class houseClassType
{
public:

///Default Constructor 
houseClassType(void);

///Destructor
~houseClassType(void);

};

#endif

House .cpp file:

#include "Standards.h"
#include "Realtor.h"
#include "house.h"

houseClassType::houseClassType()
{
}

Main driver .cpp file: (Error is here)

#include "Standards.h"
#include "Realtor.h"
#include "house.h"

int main(void)
{
ifstream fin;
ofstream fout;

string agentName;

int numberOfHomes;

houseClassType homes[NUMBER_OF_HOMES];

//Open the input and output files
fin.open("listings.txt");
fout.open("Results.txt");

InputHomes(fin, agentName, homes, numberOfHomes);

}

I don't think I can minimize the code any more here. Just a lot of files to deal with. If anybody is wondering about the houseClassType definition being empty, I just threw away the variables in it that would be initialized. They don't have anything to do with the error I beleive.

Smiter
  • 11
  • 4
  • Show us full text of error (copy-and-paste it here) – vladon Nov 14 '15 at 22:12
  • Error 1 error LNK2019: unresolved external symbol "public: __thiscall houseClassType::~houseClassType(void)" (??1houseClassType@@QAE@XZ) referenced in function _main – Smiter Nov 14 '15 at 22:14
  • @Smtier You forgot to add destructor in `House.cpp`. Or you may just write `~houseClassType() = default;` in `House.h`. – vladon Nov 14 '15 at 22:16
  • Would you happen to know where exactly in the house.h file the 'houseClassType() = default;'? I'm still getting errors. – Smiter Nov 14 '15 at 22:23
  • Man, copy and paste it. Don't forget tilde (`~`). – vladon Nov 14 '15 at 22:24
  • Hold on. I just replaced my old destructor: "~houseClassType(void);" with the one you suggested and it compiles without error. Why does this work, and the ~houseClassType(void) doesn't, if I may ask? – Smiter Nov 14 '15 at 22:25
  • Because you only *declare* constructor and have not provided its body. And with `= default` you said the compiler "You must use default destructor body" (which is simply empty `{ }`). – vladon Nov 14 '15 at 22:26
  • I hope one day I can look at code and point things out and explain them instantanously like you do. I've been trying to resolve this error for an hour, and you just take care of it in seconds. What's your secret? – Smiter Nov 14 '15 at 22:29
  • I just read full error text provided by you :-) – vladon Nov 14 '15 at 22:29
  • add 'return 0;' at end of main function. change int main(void) to int main(). some compilers are sensitive in main function case. – BattleTested_закалённый в бою Nov 14 '15 at 22:36
  • @Mohammadreza Does Visual Studio 2013 fall into that category of sensitivity? That's what I'm working with now. – Smiter Nov 14 '15 at 22:42
  • @vladon I hate to bother you again, but the same program you helped me fix with the destructor now won't output any data to the screen or output file. I tried cout-ing anything to the screen and it's acting like it's running through an infinite loop. – Smiter Nov 14 '15 at 23:04
  • @Smiter ask another question here with minimum verifiable example :-) – vladon Nov 14 '15 at 23:09
  • @vladon OK. Sorry I'm such a noob. – Smiter Nov 14 '15 at 23:12

0 Answers0