Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Makefile Help

Posted on 2003-10-24
15
Medium Priority
?
295 Views
Last Modified: 2010-04-15
i need to make a makefile first, to produce 16 files. I have try1.c, try2.c .....till try16.c. I need to run make to produce these 16 files,. and i have now:

list_file_1: try1.o
     cc -o list_file_1 try1.o
try1.o: try1.c
     cc -c try1.c

i donno wats wrong with them~~~ :____(

the error: 'ake: Fatal error: Don't know how to make target `try1.o
0
Comment
Question by:jtcy
  • 6
  • 3
  • 3
  • +1
13 Comments
 
LVL 4

Assisted Solution

by:n_fortynine
n_fortynine earned 600 total points
ID: 9618161
which one is your main (driver) file? you're telling it in the first line:
>>list_file_1: try1.o
while it should be a .c file

an example:
prog: prog.cpp file1.o file2.o
        CC -o prog prog.cpp file1.o file2.o
file1.o: file1.cpp file1.h
        CC -c file1.cpp
file2.o: file2.cpp file2.h
        CC -c file2.cpp

etc. (The .h part is just for when you have it)
0
 
LVL 6

Accepted Solution

by:
GaryFx earned 400 total points
ID: 9618234
Make sure that the command lines (i.e. the lines that begin with cc) begin with a tab character, and not spaces.  Also, leave a blank line between each rule set (i.e. between the cc -o list_file_1 try1.o and the try1.o : try 1.c.

Gary
0
 
LVL 4

Expert Comment

by:n_fortynine
ID: 9619884
>>Also, leave a blank line between each rule set
I don't think that is necessary???
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Expert Comment

by:GaryFx
ID: 9622242
I don't think it's necessary, either, but I've never seen a makefile that didn't do it that way.  It's just good style.
0
 

Author Comment

by:jtcy
ID: 9625269
I am so sick of this, i now have:

list_file_1: list_file_1.c try1.o
    cc -o list_file_1 list_file_1.c try1.o

try1.o: try1.c
    cc -c try1.c

it says unexpected end of line seen in line 3. what;s wrong with it? I need to make a file called list_file_1.c by using just try1.c only. I am very sure the second and the fifth line start with a tab.
0
 
LVL 4

Expert Comment

by:n_fortynine
ID: 9625277
have you tried removing that 3rd line and run makefile again?
0
 

Author Comment

by:jtcy
ID: 9625289
I tried, it;s still the same error
0
 
LVL 4

Expert Comment

by:n_fortynine
ID: 9625334
So you wrote this and it still says "unexpected end of line seen in line 3"?

list_file_1: list_file_1.c try1.o
    cc -o list_file_1 list_file_1.c try1.o
try1.o: try1.c
    cc -c try1.c

What compiler/OS are you using to run makefile? And did you create the makefile file from Windows by any chance?
0
 

Author Comment

by:jtcy
ID: 9625346
yes, that;s wat i have. um~~~ i wrote that at home on windows xp and then ssh to my sch;s server which is unix solaris i think
0
 
LVL 4

Expert Comment

by:n_fortynine
ID: 9625355
Try to create makefile on UNIX instead of windows. That might have something to do the way Windows creates text files.
0
 
LVL 6

Expert Comment

by:GaryFx
ID: 9626216
Or, if your UNIX system has a dos2unix command, run it on the file.

UNIX make is very picky with respect to characters.  It insists on tabs for command lines (no faking it with a bunch of space characters) and newlines (no carriage returns).  The convention on Microsoft operating systems is to do line breaks with CRLFs (carriage return, new line pairs).  Thus, this breaks some older programs on UNIX.

Gary
0
 
LVL 4

Expert Comment

by:n_fortynine
ID: 9826544
The points should be split between Gary and myself. The questioner never followed up anyway.
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9886728
No comment has been added lately and this question is therefore classified abandoned.

If asker wishes to close the question, then refer to
http://www.experts-exchange.com/help/closing.jsp

Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:
PAQed with 150:100 split between  n_fortynine and GaryFx

Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Sunny
EE Cleanup Volunteer
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question