Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compiling problem w/ Accelerated source

Status
Not open for further replies.
Feb 14, 2002
88
JP
in Chapter 4 (a pretty exhaustive chapter due to length, IMHO) I had a half-decent understanding of what was going on. I wrote my headers/source based on the examples in the book. Of course, I could have made a typo, but figured it would be better than just copying the source.

When I tried to compile, I get:

/tmp/ccdWuqBL.o: In function `main':
/tmp/ccdWuqBL.o(.text+0x9c): undefined reference to `read(std::basic_istream<char, std::char_traints<char> >&, Student_info&)'
/tmp/ccdWuqBL.o(.text+0xfc): undefined reference to `compare(Student_info const&, Student_info const&)'
/tmp/ccdWuqBL.o(.text+0x24e): undefined reference to `grade(Student_info const&)'


I went over the stuff, and everything looked fine to me. so, I downloaded the source from and tried to compile it -- same thing. Should I assume that there's a problem w/ the compiler? The error code looks like it's parsed the functions already, as they don't appear word for word as they do in the source.

If anyone wants to try, I downloaded the Unix Source from the site, and tried to compile (in chapter 4) main3.cc


g++ main3.cc -o main3


Thanks
 
Those 3 functions read() compare() and grade() are in the class Student_info and grade. You must first compile those 2 classes, because the defination of those 3 functions are not in the .h file. Also one of the functions depend on the class median as well
use
g++ -c grade.cc
g++ -c Student_info.cc
g++ -c median.cc
Those 3 lines will generate 3 .o files, then compile your main3.cc as follows
g++ -o main3 main3.cc grade.o Student_info.o median.o
This should solve your problem.
 
Thanks for the input. I actually noticed a makefile in the source from the page, and managed to string it together that way. :)

I appreciate your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top