[英]microchip MPLAB X IDE v2.15 “can't generate code for this expression”
[英]“File can not be opened” compiler error in MPLABX /MPLAB IDE
我是尝试精简PIC的新手,我下载了MPLAB和MPLAB X IDE。 我已经进行了大约100次,并且在问这个问题之前已经在网络上浏览了足够多的内容,但是我的代码无法编译,并且始终会失败。
这是我所做的:
16F871.H
库头(我在其中创建了项目),并将其添加到MPLAB IDE中的头文件中。 这是我的代码:
// IFIN.C Tests an input
#include " 16F877A.h "
void main()
{
int x; // Declare variable
output_D(0); // Clear all outputs
while(1) //
{
x = input(PIN_C0); // Get input state
if(x = = 1)
output_high(PIN_D0); // Change output
}
}
但是在编译代码时,出现以下错误:
Executing:
"C:\Program Files\PICC\Ccsc.exe" +FM "NEW.c" #__DEBUG=1 +ICD +DF +LN
+T +A +M +Z +Y=9 +EA #__16F877A=TRUE
*** Error 18 "NEW.c" Line 2(10,23): File can not be opened
Not in project "C:\Users\jatin\Desktop\DHAKKAN PIC\ 16F877A.h "
Not in "C:\Program Files\PICC\devices\ 16F877A.h "
Not in "C:\Program Files\PICC\drivers\ 16F877A.h "
*** Error 128 "NEW.c" Line 2(10,17): A #DEVICE required before this line
*** Error 12 "NEW.c" Line 6(9,10): Undefined identifier -- output_D
*** Error 12 "NEW.c" Line 9(10,11): Undefined identifier -- input
*** Error 51 "NEW.c" Line 10(8,9): A numeric expression must appear here
5 Errors, 0 Warnings. Build Failed. Halting build on first failure as requested.
BUILD FAILED: Mon Jul 08 15:09:17 2013
如果您能帮助我,我将不胜感激。
关于找不到头文件的错误是头名称中有多余的空间。 换句话说,这是:
#include " 16F877A.h "
应该:
#include "16F877A.h"
其他错误可能是由此导致的,一旦正确包含标头,该错误就会消失。
请注意,编译器从字面上将""
或<>
的字符串用作头文件的文件名,并且不会为您修剪空格。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.