|
From: Reid T. <Rei...@at...> - 2003-09-30 16:19:32
|
for some reason it is not linking in compile.o My compile log: Compiler: Default compiler Building Makefile: "C:\Downloads\jnk\Makefile.win" Executing make clean rm -f main.o compile.o jnk1.exe g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include" g++.exe -c compile.cpp -o compile.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include" g++.exe main.o compile.o -o "jnk1.exe" -L"C:/Dev-Cpp/lib" Execution terminated Compilation successful do this, create a new project using the menu remove the default main.c program created=20 using the menu add files ( your three files ) then build & run reid > -----Original Message----- > From: Opacki, Joseph [mailto:Jos...@ng...]=20 > Sent: Tuesday, September 30, 2003 12:08 PM > To: 'dev...@li...' > Subject: RE: [Dev-C++] Newbie: Linker Errors >=20 >=20 > Reid >=20 > I'm not getting the same errors... My errors do not say a=20 > line number and only appear as such: >=20 > [Linker error] undefined reference to=20 > `DigitalTime::DigitalTime()' [Linker error] undefined=20 > reference to `operator>>(std::istream&, DigitalTime&)'=20 > [Linker error] undefined reference to `DigitalTime::advance(int)'=20 > [Linker error] undefined reference to `operator=3D=3D(DigitalTime=20 > const&, DigitalTime const&)'=20 > [Linker error] undefined reference to=20 > `operator<<(std::ostream&, DigitalTime const&)' [Linker=20 > error] undefined reference to `DigitalTime::advance(int, int)'=20 >=20 > Here's my compiler log: >=20 > ------------------------------------------------------- > Compiler: Default compiler > Executing g++.exe... > g++.exe "C:\compile\main.cpp" -o "C:\compile\main.exe" > -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" > -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include"=20 > -L"C:\Dev-Cpp\lib" > C:\DOCUME~1\opackjo\LOCALS~1\Temp/ccEVaaaa.o(.text+0x134):main.cpp: > undefined reference to `DigitalTime::DigitalTime()' > C:\DOCUME~1\opackjo\LOCALS~1\Temp/ccEVaaaa.o(.text+0x143):main.cpp: > undefined reference to `DigitalTime::DigitalTime()' > C:\DOCUME~1\opackjo\LOCALS~1\Temp/ccEVaaaa.o(.text+0x16c):main.cpp: > undefined reference to `operator>>(std::istream&, DigitalTime&)' > C:\DOCUME~1\opackjo\LOCALS~1\Temp/ccEVaaaa.o(.text+0x189):main.cpp: > undefined reference to `DigitalTime::advance(int)' > C:\DOCUME~1\opackjo\LOCALS~1\Temp/ccEVaaaa.o(.text+0x19c):main.cpp: > undefined reference to `operator=3D=3D(DigitalTime const&,=20 > DigitalTime const&)' > C:\DOCUME~1\opackjo\LOCALS~1\Temp/ccEVaaaa.o(.text+0x1e2):main.cpp: > undefined reference to `operator<<(std::ostream&, DigitalTime const&)' > C:\DOCUME~1\opackjo\LOCALS~1\Temp/ccEVaaaa.o(.text+0x218):main.cpp: > undefined reference to `operator<<(std::ostream&, DigitalTime const&)' > C:\DOCUME~1\opackjo\LOCALS~1\Temp/ccEVaaaa.o(.text+0x234):main.cpp: > undefined reference to `DigitalTime::advance(int, int)' > C:\DOCUME~1\opackjo\LOCALS~1\Temp/ccEVaaaa.o(.text+0x261):main.cpp: > undefined reference to `operator<<(std::ostream&, DigitalTime=20 > const&)' Execution terminated >=20 > ------------------------------------------------------- >=20 > -----Original Message----- > From: Reid Thompson [mailto:Rei...@at...] > Sent: Tuesday, September 30, 2003 11:25 AM > To: Opacki, Joseph; dev...@li... > Subject: RE: [Dev-C++] Newbie: Linker Errors >=20 >=20 > 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=20 > once for each=20 > function it appears in.) > compile.cpp: In function `std::ostream&=20 > 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 >=20 > Then you need to declare each of these missing values( or=20 > spell them as they have been declared ). > hour =3D (hour + hourAdded)%24; should hourAdded be=20 > hoursAdded per void DigitalTime::advance(int hoursAdded, int=20 > minutesAdded) >=20 > if (theOjbect.minute < 10) -> as above spelling counts >=20 > readHours(ins, theObject.hour); -> ditto >=20 > readHours(ins, theObject.hour); -> ditto > reid >=20 >=20 >=20 >=20 > > -----Original Message----- > > From: Opacki, Joseph [mailto:Jos...@ng...] > > 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 > > 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 > > Am I not understanding the whole seperate file compilation? > > 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 >=20 > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >=20 |