Thread: make file problem

  1. #1
    Musicman - Canora
    Join Date
    Aug 2005
    Location
    Melbourne
    Posts
    252

    make file problem

    Hey guys im trying to compile multiple .c source files with .h files
    i keep gettin an error using a makefile in unix

    "fatal error in reader: makefile, line 17: unexpexted end of line seen" i have no idea what im doin wrong could someone help troubleshoot

    Code:
    all: ts.o ts_utility.o ts_options.o
    	gcc -o ts ts.o ts_utility.o ts_options.o
    
    main.o: ts.c ts.h
    	gcc -Wall -ansi -pedantic -c ts.c
    
    options.o ts_options.c ts_options.h
    	gcc -Wall -ansi -pedantic -c ts_options.c
    
    util.o  ts_utility.c ts_utility.h
    	gcc -Wall -ansi -pedantic -c ts_utility.c

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    A guess:
    Code:
    all: ts.o ts_utility.o ts_options.o
    	gcc -o ts ts.o ts_utility.o ts_options.o
    
    main.o: ts.c ts.h
    	gcc -Wall -ansi -pedantic -c ts.c
    
    options.o: ts_options.c ts_options.h
    	gcc -Wall -ansi -pedantic -c ts_options.c
    
    util.o:  ts_utility.c ts_utility.h
    	gcc -Wall -ansi -pedantic -c ts_utility.c
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Musicman - Canora
    Join Date
    Aug 2005
    Location
    Melbourne
    Posts
    252

    iv got a warning now

    its all good but now i get a different error its actually a warning sayin
    " Warning newline is not last character in file makefile" i have no idea

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    That one means just what it says. Go to the end of the file, hit enter/return, and save the file.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Why does the newline matter? Just curious.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  6. #6
    Musicman - Canora
    Join Date
    Aug 2005
    Location
    Melbourne
    Posts
    252
    just want the make file to compile completely

    so thats all it means about the enter

  7. #7
    Musicman - Canora
    Join Date
    Aug 2005
    Location
    Melbourne
    Posts
    252

    data files with makefile

    sorry guys just one last question just say for example i want to compile it with data files .csv files would i need to include it in the make file especially if the program is going to be reading and writing to them if so where would i include it?

  8. #8
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by bazzano
    would i need to include it in the make file especially if the program is going to be reading and writing to them if so where would i include it?
    If I understand you right then the compiled program is going to read from and write to .csv files. So the function of the program is not depending on some data in .csv files. In this case you don't have to include them in the makefile.
    It would be different if you woud have some pre-processor that creates source-code or header files from some data in csv files.
    In that case you could put something like that into the makefile

    Code:
    options.o: ts_options.c ts_options.h autoheader.h
    	gcc -Wall -ansi -pedantic -c ts_options.c
    
    autoheader.h: data.csv
            myprocessor data.csv
    This would make options.o depending on autoheader.h and autoheader.h would depend on data.csv
    the rule to create autoheader.h would be to run myprocessor with data.csv as input.
    Kurt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM