![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk Shell Script error : "Syntax Error : `Split' unexpected | Herry | UNIX for Dummies Questions & Answers | 2 | 03-17-2008 08:16 AM |
| error during run: St9bad_alloc - Getting this error while using some conversion progr | sathu_pec | Shell Programming and Scripting | 1 | 01-20-2008 11:38 PM |
| I got error like...syntax error on line 1, teletype | koti_rama | UNIX for Advanced & Expert Users | 2 | 07-07-2007 04:35 PM |
| error reading sections error at install | doelman | SUN Solaris | 2 | 02-05-2007 09:21 AM |
| Error: Internal system error: Unable to initialize standard output file | firkus | UNIX for Dummies Questions & Answers | 2 | 10-25-2005 12:23 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#15
|
|||
|
|||
|
Quote:
Dear Corona I have to call you my coach. Thank you very much for taking your time to put all this line and explain for me. I learn a lot from explaination. Here is what I found by following your instruction, I ran the first program using gcc and it work, and second program with function and using gcc and it work. Then when it came to makefile one. I have receive the below error couliba@linux:~/main> make clean rm -f main main.o library_function.o couliba@linux:~/main> make main cc -c -o main.o main.c make: *** No rule to make target `library_function.o', needed by `main'. Stop. couliba@linux:~/main> Do not u think, the problem is my lunix installation. Because this is my notebook I just recently install lunix. Any help is appreciated |
| Forum Sponsor | ||
|
|
|
#16
|
|||
|
|||
|
Simply the wrong filename. It goes by file extension, it does not know how to make a library_function.o when there's no library_function.c . Change library_function.c and library_function.o to library.c and library.o respectively and it should work.
Come to think of it, that was a mistake in my example wasn't it? Oops. Fixed. Last edited by Corona688; 07-11-2006 at 07:26 AM. |
|
#17
|
|||
|
|||
|
Quote:
Dear Corona Thank you very, I did the changes and it work for the simple. but I applied to my code and I still receive the smilar erorr but not as much as earlier. I have created object files for all my C files. You may need view the below tag. Quote:
Thank you dear |
|
#18
|
|||
|
|||
|
Don't call people 'dear' unless you're married to them.
Your makefile is wrong. It's compiling all the C files together instead of all the objects. Which, while it will work, is awkward and hard to debug, avoids all the advantages of using a makefile in the first place, and does all the work twice. Instead of Code:
cc file.c file2.c file3.c ... -o exec Code:
cc file.o file2.o file3.o ... -o exec Code:
LDFLAGS=-lm If you're still missing functions, you're missing a file. Maybye whoever gave you the code didn't give you all of it. |
|
#19
|
|||
|
|||
|
Quote:
Coach Thank you very much the code is working very well now. You make it successful. I appreciate so much all your efort and sharing of knowledge. Acctually all files are completed. I have test the codes in my friend's notebook last three month ago before I bought my notebook and it work without any problem. However, when I bought my own notebook and install linux then all this problem start to come out. By the way my friend is using suse 10 and I am using suse 9.3. I am not sure if that can make any different. I have one concern to ask you. After add -lm to the makefile, there was only one warning appeared saying this: /tmp/ccYaBtHR.o (.text+0X33): In function 'get_boolean': util.c:warning: the 'gets' function is dangerouns and should not be used. To avoid this warning what I do, I went to util.c file and comment out gets(line); then the program work very well. Any idea why this warning. Is possible to run the program without commenting out this line? Again thank you very much |
|
#20
|
|||
|
|||
|
Without seeing util.c I can't know what it's using gets for. gets reads a string from standard input, storing it as a character array terminated by a NULL character.
The problem with gets is that it takes an unlimited amount of input. It does not know how much space is available in the buffer. For instance: Code:
#include <stdio.h>
int main()
{
char buf[16];
gets(buf);
printf("You typed %s\n",buf);
return(0);
}
This is much safer: Code:
#include <stdio.h>
int main()
{
char buf[16];
fgets(buf,16,stdin);
printf("You typed %s\n",buf);
return(0);
}
|
|||
| Google The UNIX and Linux Forums |