Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You\'ve joined a C++ software project already in progress. The project has a cla

ID: 3759503 • Letter: Y

Question

You've joined a C++ software project already in progress.

The project has a class, personType, containing certain data about a perons and a struct, tm, which is devoted to keeping track of time.

These two data structures are defined in the attached header files PersonType.h and gettime.h.

The associated files, PersonType.cpp and time.cpp, implement the functionality defined in those header files.

(Note that the definition of the PersonType class includes a field of type tm.)

The file TestProg.cpp was written to exercise the code a bit, creating several PersonType objects and manipulating their tm's.

At least that was the plan. The project actually does not build successfully at this point!

It gets the following error messages from Visual Studio:

1>------ Build started: Project: Lab10, Configuration: Debug Win32 ------

1>  PersonType.cpp

1>TestProg.obj : error LNK2019: unresolved external symbol "public: void __thiscall personType::setTime(struct tm)" (?setTime@personType@@QAEXUtm@@@Z) referenced in function _main

1>TestProg.obj : error LNK2019: unresolved external symbol "public: struct tm __thiscall personType::getTime(void)const " (?getTime@personType@@QBE?AUtm@@XZ) referenced in function _main

1>c:usersjohndocuments isual studio 2013ProjectsLab10DebugLab10.exe : fatal error LNK1120: 2 unresolved externals

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

From your experience in CPS 171, you realize these two errors concerning "unresolved externals" arise at the time the program pieces are stitched together by the linker--it didn't find the "setTime" and "getTime" functions which the personType class declares (and, more importantly, which main() tries to use in TestProg.cpp).

You can save the project! Implement these functions defined in PersonType.h

                void setTime(struct tm);

                struct tm getTime() const;

in the file PersonType.cpp.

It's not a lot of code, but knowing how and where to do it, in a project you just inherited, is a great skill!

Knowing what to pay attention to and what to ignore is a useful skill in forming a "cognitive map" of a program.

Given files:

gettime.h

PersonType.h

TestProg.cpp

time.cpp

Explanation / Answer

Change this in your program it will work fine

void personType::print() const
{
cout << firstName << " " << " "<<middleName<<" "<<lastName;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote