XC8错误224:非法#指令(第一行) [英] XC8 error 224: illegal # directive (first line)

查看:402
本文介绍了XC8错误224:非法#指令(第一行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Microchip的XC8编译器。他们要我的#include< xc.h> ,而不是包括特定芯片的头。然而,当我添加此code在我的code的第一线,我得到了错误:

I'm using Microchip's XC8 compiler. They want me to #include <xc.h> instead of including a chip-specific header. However, when I add this code on the first line of my code, I'm getting the error:

Error [224] C:\...\main.c; 1.4 illegal "#" directive

在我的指令之前放置一个换行,我没有得到这个错误。为什么是这样?

When I place a line feed before the directive, I don't get the error. Why is this?

我的全code:

#include <xc.h>

#pragma config OSC =INTIO67, WDT = OFF, LVP = OFF, PBADEN = OFF

void main() {
    while (1);
}

通过换行,在code看起来是一样的,但在顶部的空行。

With the line feed, the code looks just the same, but with a blank line on top.

推荐答案

有一件事可能会导致这个是不属于你的文本编辑器中可见的文件开始腐败或其他字符。根据编辑器很可能是字节顺序标记了与统一code使用文件。我建议采取看看有十六进制编辑器这样就可以了查找可能导致问题的任何字符。

One thing that may cause this is corruption or other characters at the start of the file that aren't visible within your text editor. Depending on the editor it may well be the byte order mark that is used with Unicode files. I suggest taking a look at the first few lines of the file with a hex editor so that you can locate any characters that may be causing the problem.

这篇关于XC8错误224:非法#指令(第一行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆