Question:
Makefile errors for a C project. Why do I have them and how do I fix them?
the+university_guy
2008-06-20 20:54:06 UTC
Okay, I've been programming a C project in a Linux environment using eclipse CDT. My project had been giving me errors for the .c file, until I began messing around with the encoding out of boredom. After that, eclipse hasn't been the same. Some how, without changing any code, my .c file no longer has any errors (figure that). Yet, the eclipse console keeps giving me the same two errors, supposedly for the same line (line 1). These are the following two (paraphrasing a little):
'NUL' character; rest of line ignored.
"*** missing separator. Stop."

Now, I know some C programmers might just comment that I shouldn't be using eclipse cdt, but eclipse cdt and linux is awesome for me because it makes writing in C much easier, since I already don't know the language that well.

I would provide a copy of my makefile although it's nothing I can/should edit myself, but it seems that my Vista partition can't read my Linux partition - even though my Linux file system can read my NTFS.
Four answers:
sspade30
2008-06-20 20:59:53 UTC
try to compile at command line and see what you get. Sounds like the .c file is corrupted to me.
Steve G
2008-06-20 22:22:25 UTC
The way C handles strings, a NULL character is the end of the string. It sounds like you have a NULL at the beginning of your source file, and the compiler is treating that as the end of the line. It's possible that Eclipse doesn't mind the NULL, but the compiler obviously does.



Get a hex editor and look at the file. I usually use "shed", but you can use whatever you're comfortable with. Look for a character "00" -- the NULL character means a character whose ASCII value is zero. Change it to something else, probably whitespace, and see if that fixes it.
2008-06-21 08:20:52 UTC
the "***missing separtor" message is coming from your makefile. When you messed with the encoding you probably zapped all the TAB characters in the makefile. Make is *really* fussy about its whitespace. Go back and reconstruct your makefile and put the tabs in where needed and I suspect you will be back to where you were - trying to get rid of your C compile errors. :)
2016-04-04 09:31:09 UTC
a main function: int main(int argc,char* argv[]) is the beginning point of a c program. argc is the argument count and argv is an array of arguments passed to the program. really. i think you should restudy c++.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...