Question: I have a C++ project with 3 files (House.h, House.cpp, houses.cpp (main)). When I attempt to run main() I get an error but unsure what

I have a C++ project with 3 files (House.h, House.cpp, houses.cpp (main)).

When I attempt to run main() I get an error but unsure what it means.

Here is my c++ version info.

c++ - v : Apple LLVM version 8.1.0

Target: x86_64-apple-darwin16.4.0

Thanks in advance.

BELOW:

1. House.h

2. House.cpp

3. houses.cpp

4. error message

/***** House.h BELOW******/

/* House.h June 24, 2017

This is the header file. */ #ifndef HOUSE_H_ #define HOUSE_H_ #include using namespace std;

class House { private: //instance data declared as private. string houseColor; int numBathrooms; int numBedrooms; double squareFeet;

public: //function protoypes declares as public. //constructors House(); House(string, int, int, double);

//destructor ~House();

//accessor methods string getColor(); int getNumBath(); int getNumBed(); double getSqft();

//mutator methods void setColor(string); void setNumBath(int); void setNumBed(int); void setSqft(double); };

#endif /* HOUSE_H_ */

/***** House.cpp BELOW******/

/* House.cpp June 24, 2017

This is the class file and contains the body of the function protoypes listed in the header file. */ #include "House.h" #include

using namespace std; //default constructor House::House() //Scope resolution operator. { //Constructor belongs to Class. houseColor = "Blue"; numBathrooms = 2; numBedrooms = 3; squareFeet = 1200; } House::House(string color, int numBath, int numBed, double sqft) { houseColor = color; numBathrooms = numBath; numBedrooms = numBed; squareFeet = sqft;

} //destructor method House::~House() { //cout<<"I'm in the destructor"<

//accessor methods string House::getColor() { return houseColor; } int House::getNumBath() { return numBathrooms; } int House::getNumBed() { return numBedrooms; } double House::getSqft() { return squareFeet; }

//mutator methods void House::setColor(string c) { houseColor = c; } void House::setNumBath(int bath) { numBathrooms = bath; } void House::setNumBed(int bed) { numBedrooms = bed; } void House::setSqft(double sqft) { squareFeet = sqft; }

/***** houses.cpp BELOW******/

/* houses.cpp June 24, 2017 */ #include #include "House.h" #include using namespace std;

void printHouse(House); //function prototype.

int main() { //Create an instance of the House class //using the default constructor House house1;

//Create a second instance //provide values for color, bed, bath, and sqft House house2("Tan", 3, 2, 2500);

//print house information printHouse(house1); printHouse(house2); return 0; } void printHouse(House house) { //print the house information using //the dot operator cout<<"House Color: "<

//since it is a void function, //I do not need a return statement }

/***** error message BELOW******/

/var/folders/lc/fw0xdsj9287f5ppm25mmkhhc0000gn/T//ccgonW3a.s:4:11: warning: section "__textcoal_nt" is deprecated

.section __TEXT,__textcoal_nt,coalesced,pure_instructions

^ ~~~~~~~~~~~~~

/var/folders/lc/fw0xdsj9287f5ppm25mmkhhc0000gn/T//ccgonW3a.s:4:11: note: change section name to "__text"

.section __TEXT,__textcoal_nt,coalesced,pure_instructions

^ ~~~~~~~~~~~~~

Undefined symbols for architecture x86_64:

"House::getNumBath()", referenced from:

printHouse(House) in cc49GaE2.o

"House::getSqft()", referenced from:

printHouse(House) in cc49GaE2.o

"House::getColor[abi:cxx11]()", referenced from:

printHouse(House) in cc49GaE2.o

"House::House(std::__cxx11::basic_string, std::allocator >, int, int, double)", referenced from:

_main in cc49GaE2.o

"House::House()", referenced from:

_main in cc49GaE2.o

"House::~House()", referenced from:

_main in cc49GaE2.o

ld: symbol(s) not found for architecture x86_64

collect2: error: ld returned 1 exit status

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!