编译C代码的简单错误

时间:2014-04-12 05:10:29

标签: c include

这是我得到的错误:

genlib.h:225:1: error: stray ‘\32’ in program

genlib.h定义于:http://pastebin.com/KgM3J24W

这是我的代码:

/*
 * file: hello.c
 * -----------
 *  This program prints the message "Hello World."
 *  On the screen. The program is taken from the 
 *  classic C reference text "The C Programing
 *  Language" by Brian Kemighan and Dennis Richie.
 */

#include <stdio.h>
#include "genlib.h"

int main()
{
    printf("Hello, World.\n");
    return 0;
}

1 个答案:

答案 0 :(得分:0)

打开文件 genlib.h ,转到最后一行有垃圾字符的行(如链接页http://pastebin.com/KgM3J24W中所示),删除该字符,然后然后再次保存文件。

如果您的编辑器没有显示垃圾字符,也许您可​​以尝试创建一个名为 genlib2.h 的新空文件,从 genlib.h <复制内容< / strong>(没有垃圾),保存 genlib2.h ,然后将 genlib2.h 重命名为 genlib.h

隐形字符(032八进制)也可以写为 ^ Z ,并在MS-DOS和旧Windows中用于表示文件结尾。输入 genlib.h 的内容时,有人可能会错误地添加了它。