Ok, here's what I've done. I've added main back to the program5.cpp file, deleted the #include "program5.cpp" part from the prog5Search.cpp file, and I think I've declared all the needed variables in the prog5Search.cpp file. This has gotten rid of most of the errors, but I've still got one that I can't figure out.
1 2 3
/tmp/ccSbFaA4.o: In function `main':
prog5Search.cpp:(.text+0x15f): undefined reference to `operator<<(std::basic_ostream<char, std::char_traits<char> >&, Record const&)'
collect2: ld returned 1 exit status
But the program5.cpp file is the one reading the data file and creating the index file, so I did
1) never include traditional implementation files
2) The whole point for your search program is to be separate from creating file. You should have 2 programs: one to create index file from data file and second to open index file and search for needed entry.
Doesn't grep search a file for a specified word, number, etc?
Grep displays each line that contains the "word" (actually a regular expression).
You want to display each line that contains "id" (which is essentially a word).
Oops, yep that was it. It compiles now. However, when I run the search 12345 prog5.idx I get a "command not found error". I tried grep 12345 prog5.idx as well, but nothing is displayed?