|
From: Yimin <zy...@ya...> - 2001-08-29 19:21:23
|
I was trying to compile a small program when the following messages = popped up in the "Compiler and Linker Output" window: c:\windows\TEMP\cc16bbgb.o(.text+0x110):gradefv.cpp: undefined reference = to `read(istream &, Student_info &)' c:\windows\TEMP\cc16bbgb.o(.text+0x194):gradefv.cpp: undefined reference = to `compare(Student_info const &, Student_info const &)' c:\windows\TEMP\cc16bbgb.o(.text+0x2b5):gradefv.cpp: undefined reference = to `grade(Student_info const &)' The compilation was said to be successful though. But there was zero = output. By the way, I am learning C++ on my own by reading Accelerated C++ = Practical Programming by Example by A. Koenig and B. Moo. This problem = occurred when I attempted to compile the example program. I checked the = authors' source code too and attempted to run theirs. Their program had = the same problem. What could be the problem? Help will be appreciated. jyz |
|
From: Ioannis V. <no...@ya...> - 2001-08-29 21:37:02
|
Send us the source code. =20 =20 Ioannis =20 * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com <http://www.noicys.f2s.com/>=20 * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Yimin Sent: Wednesday, August 29, 2001 9:20 PM To: Dev...@li... Subject: [Dev-C++] Help Needed I was trying to compile a small program when the following messages popped up in the "Compiler and Linker Output" window: =20 c:\windows\TEMP\cc16bbgb.o(.text+0x110):gradefv.cpp: undefined reference to `read(istream &, Student_info &)' c:\windows\TEMP\cc16bbgb.o(.text+0x194):gradefv.cpp: undefined reference to `compare(Student_info const &, Student_info const &)' c:\windows\TEMP\cc16bbgb.o(.text+0x2b5):gradefv.cpp: undefined reference to `grade(Student_info const &)' The compilation was said to be successful though. But there was zero output. By the way, I am learning C++ on my own by reading Accelerated C++ Practical Programming by Example by A. Koenig and B. Moo. This problem occurred when I attempted to compile the example program. I checked the authors' source code too and attempted to run theirs. Their program had the same problem. What could be the problem? Help will be appreciated. jyz |
|
From: Johannes P. <joh...@pr...> - 2001-08-30 07:36:25
|
[Project] FileName=D:\temp\s\Grades.dev Name=Grades Use_gpp=1 UnitCount=7 ResFiles=D:\temp\s\rsrc.rc NoConsole=0 IsDll=0 Icon=C:\Usr\Shared\APPLIC~1\DEVC__~1\Bin\Mainicon.ico [Unit1] FileName=D:\temp\s\grade.cpp FileTime=723406292 [Unit2] FileName=D:\temp\s\grade.h [Unit3] FileName=D:\temp\s\gradefv.cpp [Unit4] FileName=D:\temp\s\median.cpp [Unit5] FileName=D:\temp\s\median.h [Unit6] FileName=D:\temp\s\Student_info.cpp [Unit7] FileName=D:\temp\s\Student_info.h |
|
From: Jeremy Z. <zy...@ya...> - 2001-08-30 15:27:41
|
Thanks, Johannes, for your help. jyz
----- Original Message -----=20
From: Johannes Pretorius=20
To: dev...@li...=20
Sent: Thursday, August 30, 2001 12:50 AM
Subject: Re: [Dev-C++] Help Needed
Lo there
------------
There is 2 things wrong with this program. First the projects is not =
correct (there is no project file) make one or Edit=20
the one I attached to point to your paths.
Secondly there is no function writen for the grade function declared =
in the header for grade.cpp
I wrote a dummy like
//=3D=3D=3D=3D=3D=3D SNIP =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
double grade(const Student_info& student){
//Some stuff to get the grade :)..
return -1;
}
//=3D=3D=3D END SNIP =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Well I hope this helps. After that it all compiles and works
PS : The reason the stuff didnt compile first is because the header =
files was not in the Compiler's path to start from=20
Well C ya
Johannes
At 16:37 29/08/2001 -0700, you wrote:
Thank you, Ioannis, for responding to my inquiry. Here are the =
files. For your information I was trying to compile "gradefv.cpp" with =
all other cpp files and header files. Thanks.
=20
jyz=20
----- Original Message -----=20
From: Ioannis Vranos=20
To: dev...@li...=20
Sent: Wednesday, August 29, 2001 3:38 PM=20
Subject: RE: [Dev-C++] Help Needed
Send us the source code.=20
=20
=20
Ioannis=20
=20
* Ioannis Vranos=20
* Programming pages: http://www.noicys.f2s.com=20
* Alternative URL: http://run.to/noicys=20
-----Original Message-----=20
From: dev...@li... =
[mailto:dev...@li...] On Behalf Of Yimin=20
Sent: Wednesday, August 29, 2001 9:20 PM=20
To: Dev...@li...=20
Subject: [Dev-C++] Help Needed
I was trying to compile a small program when the following =
messages popped up in the "Compiler and Linker Output" window:=20
=20
c:\windows\TEMP\cc16bbgb.o(.text+0x110):gradefv.cpp: undefined =
reference to `read(istream &, Student_info &)'
c:\windows\TEMP\cc16bbgb.o(.text+0x194):gradefv.cpp: undefined =
reference to `compare(Student_info const &, Student_info const &)'
c:\windows\TEMP\cc16bbgb.o(.text+0x2b5):gradefv.cpp: undefined =
reference to `grade(Student_info const &)'
The compilation was said to be successful though. But there was =
zero output.
By the way, I am learning C++ on my own by reading Accelerated C++ =
Practical Programming by Example by A. Koenig and B. Moo. This problem =
occurred when I attempted to compile the example program. I checked the =
authors' source code too and attempted to run theirs. Their program had =
the same problem. What could be the problem? Help will be appreciated.
jyz
|
|
From: <gi...@li...> - 2001-08-30 17:05:21
Attachments:
yimin.zip
|
Hi, I took a quick look at your source code, there is something that needs to be fixed but first here is why you get the 3 "undefined" errors. As the word "undefined" says, there is some definition missing: your program is made up of 4 source files, this means that to build the executable you need to compile the 4 files and link them together. If you use the Dev-C++ IDE you should create a project, add the 4 source files to it and then go ahead with a compilation (which in the case of Dev-C++ implies also the linking step). I think that you just opened the file "gradefv.cpp" in the edit window of Dev-C++ and then went on with a compilation: since you did not specify where the definitions of the 3 functions "read", "compare" and "grade" are, the linker issued the "undefined" error. As I said before there is something more: - I looked at the file "grade.cpp" but saw no definition for the function "double grade(const Student_info&)": this means that even if you link "grade.cpp", there will still be an "undefined" error about this function. - To be consistent with your programming style, the file "median.cpp" should include the file "median.h" Just in case you are not using the Dev-C++ IDE, but are familiar with the "make" program and the CLI interface of mingw, I attached the files "gradefv.mk" and "b.bat" which you could use to build your program. At 12.20 29/08/01 -0700, you wrote: >I was trying to compile a small program when the following messages popped >up in the "Compiler and Linker Output" window: > >c:\windows\TEMP\cc16bbgb.o(.text+0x110):gradefv.cpp: undefined reference >to `read(istream &, Student_info &)' > >c:\windows\TEMP\cc16bbgb.o(.text+0x194):gradefv.cpp: undefined reference >to `compare(Student_info const &, Student_info const &)' > >c:\windows\TEMP\cc16bbgb.o(.text+0x2b5):gradefv.cpp: undefined reference >to `grade(Student_info const &)' > >The compilation was said to be successful though. But there was zero output. > >By the way, I am learning C++ on my own by reading Accelerated C++ >Practical Programming by Example by A. Koenig and B. Moo. This problem >occurred when I attempted to compile the example program. I checked the >authors' source code too and attempted to run theirs. Their program had >the same problem. What could be the problem? Help will be appreciated. > >jyz -- gisan gi...@li... |