Categories

วันจันทร์ที่ 1 มิถุนายน พ.ศ. 2552

C Language on Unix FAQs

  • I am trying to use my Windows PC at home to telnet to charlie.it.uts.edu.au and use FTP to transfer my files across for compiling on the university's UNIX computers. I find that with the C language my text editors (I have tried both Wordpad and Notepad) are inserting illegal whitespace characters making my code uncompilable. The message likes: ... : warning: invalid white space character in directive This problem is due to the fact that the DOS-based and UNIX based text editers treat a line of text differently. In the DOS-based text editor, the end of a line is marked by two characters ('\n' and '\r') while the UNIX based text editor use only '\n'. You can get rid of the extra white space using tr (translate characters) tool in UNIX. Syntax used as follows: cat yourCfile.c | tr -d '\015' > yourNewCfile.c Then you can compile your new C file using cc.
  • What does the error message "... : warning: newline not last character in file" mean and how to fix it? This error is due to the fact the last line of the program is not terminated by a new line. cc does care about white spaces while gcc doesn't care. Terminate any text line by return in Wordpad/Notepad editor.

ไม่มีความคิดเห็น:

แสดงความคิดเห็น

Search

เกิดข้อผิดพลาดใน Gadget นี้