hey guys, i got an assingment due and i was wondering if you could please help me to debug this program.

5 files,
ass1.h
ass1.cpp
main.cpp
Makefile.txt (needs to be renamed to makefile for it to be used properly)
ass1.txt(needs to be renamed ass1.dat to be used[its the database for the books])

to be compiled for a linux environment

the files to be loaded needs to change from text to binary file type, i havnt been able to work out how to do that yet

no, we're not going to do that. We're certainly not going to sheepishly compile and run your code and fix it for you.

Member Avatar for iamthwee

Ask specific questions. Post your code here not as attachments. Read the forum rules etc...

well it was worth a try

i fixed it all now anyhow, except one thing, my makefile.

CC=g++

all:	ass1

ass1:	main.o ass1.o
	$(CC) main.o ass1.o -o ass1

main.o:	main.cpp ass1.h
	$(CC) -c main.cpp

ass1.o:	ass1.cpp ass1.h
	$(CC) -c ass1.cpp

there it is, and here is the error (im using SSH to compile with, its connected to uni servers running ubuntu)

$ make
make: Fatal error in reader: Makefile, line 3: Unexpected end of line seen

Try this

CC=g++
 
ass1:	main.o ass1.o
	$(CC) main.o ass1.o -o ass1
 
main.o:	main.cpp ass1.h
	$(CC) -c main.cpp
 
ass1.o:	ass1.cpp ass1.h
	$(CC) -c ass1.cpp

still not working, error got bigger


mksh: Warning: newline is not last character in file Makefile
Current working directory /home/ug/q/nt647
make: Fatal error in reader: Makefile, line 3: Unexpected end of line seen

Try implicit rules

CC = g++
 
ass1: main.o ass1.o
	$(CC) main.o ass1.o -o ass1
 
main.o:	main.cpp ass1.h
 
ass1.o:	ass1.cpp ass1.h

I just downloaded your files(.cpp & .h) and tried the Makefile. Makefile just works fine. The problem is with your codes.

??

that code there btw is out of date, i have almost completly re-written it all, (except the main.cpp)

i put all my code into one file and compiled it and it worked fine (my new stuff) but when i split it again, for the makefile to do its job, it didnt complie

Post your corrected codes(all .cpp and .h files). I will try them at my end with the Makefile.

ok, i got my makefile working, but there seems to still be an error that i cant find , int he code itself, if possible could you see if you could find it ?

dont forget to change the makefile.txt back to makefile (just a reminder :P )

the error im getting now is

main.cpp:1: error: stray '\239' in program
main.cpp:1: error: stray '\187' in program
main.cpp:1: error: stray '\191' in program

ok, fixed, that, now this error instead :"(


$ make
g++ -c main.cpp
g++ -c ass1.cpp
g++ main.o ass1.o -o ass1
Undefined first referenced
symbol in file
DisplayRecords() main.o
ld: fatal: Symbol referencing errors. No output written to ass1
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `ass1'


use that main

That's a linker error. It seems that you don't have defination of DisplayRecords() .

yea, i jsut had a thoroguh read of it, and found teh problem, please come and shoot me where i stand

DisplayRecord();
DisplayRecords();

i mixed it up in one spot :)

the makefile problems i was haveing seemed to be coming from invisible characters, i got my mate to retype on on his linux and send to me and i used that fine

but yea mate, thnx again for ur help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.