|
From: Reid T. <Rei...@at...> - 2003-09-30 15:24:37
|
if these are the messages you are getting:
compile.cpp: In member function `void DigitalTime::advance(int, int)':
compile.cpp:56: `hourAdded' undeclared (first use this function)
compile.cpp:56: (Each undeclared identifier is reported only once for
each=20
function it appears in.)
compile.cpp: In function `std::ostream& operator<<(std::ostream&, const=20
DigitalTime&)':
compile.cpp:63: `theOjbect' undeclared (first use this function)
compile.cpp: In function `std::istream& operator>>(std::istream&,=20
DigitalTime&)':
compile.cpp:73: `readHours' undeclared (first use this function)
compile.cpp: In function `void readHour(std::istream&, int&)':
compile.cpp:127: `thehour' undeclared (first use this function)
make.exe: *** [compile.o] Error 1 Execution terminated
Then you need to declare each of these missing values( or spell them as
they have been declared ).
hour =3D (hour + hourAdded)%24; should hourAdded be hoursAdded per
void DigitalTime::advance(int hoursAdded, int minutesAdded)
if (theOjbect.minute < 10) -> as above spelling counts
readHours(ins, theObject.hour); -> ditto
readHours(ins, theObject.hour); -> ditto
reid
> -----Original Message-----
> From: Opacki, Joseph [mailto:Jos...@ng...]=20
> Sent: Tuesday, September 30, 2003 10:17 AM
> To: 'dev...@li...'
> Subject: [Dev-C++] Newbie: Linker Errors
>=20
>=20
> I'm still learning so please be patient.
>=20
> I am running into some problems. I've defined my interface=20
> file as "compile.h", my implementation file as "compile.cpp",=20
> and my application file as "main.cpp". The implementation=20
> and application files both contain [ #include "compile.h" ]. =20
> However, when I try to compile my application file, I receive=20
> numerous linker errors with undefined references to my class.
>=20
> HELP! =20
>=20
> Am I not understanding the whole seperate file compilation? =20
> Isn't the class interface and implementation files supposed=20
> to be named the same and just with different extensions? =20
>=20
> I've attached all three files...thanks.
>=20
> Joe <<compile.cpp>> <<compile.h>> <<main.cpp>>=20
>=20
|