简体   繁体   中英

Error on compiling c file on MPLAB X ide

I get following errors when trying compile using MPLAB X on Windows..


newmain.c:40:9: error: unknown configuration setting: 'JTAGEN'

newmain.c:61:2: error: 'LATA' undeclared (first use in this function)

newmain.c:62:2: error: 'TRISA' undeclared (first use in this function)

newmain.c:61:2: error: 'LATA' undeclared (first use in this function)

I tried this on 2 different machines (on Windows 8.1 and Vista), but they all gave me same error.

It seemed like that xc.h file is already included to project since I can open that file. And also I googled for this problem but there wasn't a solution for this.

Thank you very much if you can give me a possible way to solve this.

I also attached photo describing project properties ​for this project.

在此处输入图片说明

Following is full description of error :

 - CLEAN SUCCESSFUL (total time: 52ms) make -f
   nbproject/Makefile-default.mk SUBPROJECTS= .build-conf make[1]:
   Entering directory 'Z:/Personal Data/MPLABXProjects/Lab01.X' make -f
   nbproject/Makefile-default.mk
   dist/default/production/Lab01.X.production.hex make[2]: Entering
   directory 'Z:/Personal Data/MPLABXProjects/Lab01.X' "Z:\Program Files
   (x86)\Microchip\xc32\v1.40\bin\xc32-gcc.exe" -g -x c -c
   -mprocessor=32MX340F512H -MMD -MF build/default/production/newmain.o.d -o
   build/default/production/newmain.o newmain.c newmain.c:40:9: error:
   unknown configuration setting: 'JTAGEN' #pragma config JTAGEN = OFF
   // JTAG Enable OFF (only use for '250)
   nbproject/Makefile-default.mk:105: recipe for target
   'build/default/production/newmain.o' failed ^ newmain.c: In function
   'main': make[2]: Leaving directory 'Z:/Personal
   Data/MPLABXProjects/Lab01.X' newmain.c:61:2: error: 'LATA' undeclared
   (first use in this function) nbproject/Makefile-default.mk:78: recipe
   for target '.build-conf' failed LATA = 0; // Set value of PORT A
   output to 0. ^ make[1]: Leaving directory 'Z:/Personal
   Data/MPLABXProjects/Lab01.X' nbproject/Makefile-impl.mk:39: recipe
   for target '.build-impl' failed newmain.c:61:2: note: each undeclared
   identifier is reported only once for each function it appears in
   newmain.c:62:2: error: 'TRISA' undeclared (first use in this
   function) TRISA = 0; // Set all pins on PORT A to output ^ make[2]:
   *** [build/default/production/newmain.o] Error 1 make[1]: *** [.build-conf] Error 2 make: *** [.build-impl] Error 2 BUILD FAILED
   (exit value 2, total time: 203ms)

And source is

#include <xc.h>

#pragma config FWDTEN = OFF, JTAGEN = OFF

void delay(void);

unsigned int ctr = 0;
unsigned int delayVal = 2048;

int main(void)
{
    LATA = 0;
    TRISA = 0xFF00;

    while(1)
    {
        LATA = 0x0055;
        delay();

        LATA = 0x00AA;
        delay();

        ctr++;
    }
}

void delay(void)
{
    unsigned int i,j;

    for (i = 0; i < delayVal; i++)
    {
        for (j = 0; j < 20; j++);
    }
}

The errors you receive indicate that the compiler does not see any libraries to reference those registers to. It treats them as regular variables instead.

You should include the specific header file for the processor you are using and also check to see what registers are structured in there to make more sense of your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM