Error No Identifier In Declaration
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up XC8 compiler error “no identifier in declaration” up vote 0 down vote favorite I recently took over some C and firmware responsibilities at work, and am having trouble with what seems like a basic issue but one that I can't find the answer to. I'm not very experienced with C, but I've had many years of experience with higher level languages. The firmware is written for a PIC18F4865 and I can't get it to compile and program correctly. It was originally written on MPLAB IDE 8 using the HI-TECH PICC18 compiler, but I moved up to MPLAB X IDE and have been having problems. First, I was using the same HI-TECH PICC18 compiler and it appeared to program successfully, but the device was not reading correctly. I then switched to the XC8 compiler and began to get an error message during compile that I can't get around. C:/_Sable/Firmware_C/lib\eeprom.h:10: error: no identifier in declaration C:/_Sable/Firmware_C/lib\eeprom.h:10: error: ";" expected The eeprom.h file is #ifndef _EEPROM_H_ #define _EEPROM_H_ #define EE_ADDR(member) (offsetof(struct ee_map_s, (member))) extern unsigned char eeprom_read(unsigned int); // this is line 10 extern void eeprom_write(unsigned int, unsigned char); extern void ee_read(unsigned char, void *vp, unsigned char); extern void ee_write(unsigned char, void *vp, unsigned char); #endif I looked around online and saw that this error can occur in a previous included file, and I checked that file and all appeared to be fine. I even rearranged the include order, think that the error message would change if that was the case, but the error still complains about this line. I then thought maybe the function declaration w
tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Electrical Engineering Questions Tags Users Badges Unanswered Ask Question _ Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. Join them; it only takes a minute: Sign up Here's http://stackoverflow.com/questions/12534092/xc8-compiler-error-no-identifier-in-declaration how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top XC8 Interrupt function qualifier up vote 2 down vote favorite Referring to the XC8 user manual, DS50002053E, section 2.5.10.3 the following is stated: For 8-bit compilers, change any occurrence of the interrupt qualifier e.g., from: void interrupt low_priority myLoIsr (void) http://electronics.stackexchange.com/questions/169204/xc8-interrupt-function-qualifier to the following: void __interrupt(low_priority) myLoIsr(void) Here's a simple piece of code I wrote: void __interrupt(high_priority) isr_high (void) { // IFC if(INTCON3bits.INT2IF) { TMR0 = TMR1 = timerZero; // Reset the IFA and IFB counts ++ifc; ifa = ifb = 0; LATEbits.LATE0 ^= 1; INTCON3bits.INT2IF = 0; } } And here is a piece of sample code that the XC8 manual offers in section 2.5.10.1: __interrupt(low_priority) void getData (void){ if(TMR0IE && TMR0IF) { TMR0IF = 0; ++tick_count; } } Unfortunately I cannot get the code to compile. Here are some relevant compiler errors: (908) exit status = 1 Minion.c:215: error: (285) no identifier in declaration make2: [build/default/production/Minion.p1] Error 1 make1: * [.build-conf] Error 2 Minion.c:215: error: (1275) only functions may be qualified "interrupt" make: *** [.build-impl] Error 2 Minion.c:215: error: (372) "," expected Minion.c:216: error: (314) ";" expected* Now, the manual is a little bit ambiguous because the section example in 2.5.10.1 shows the interrupt function identifier 'void' immediately prior to the function name, where as section 2.5.10.3 shows the void identifier immediately prior to __interrupt. However, I have tried it both ways with no
are UTC - 7 hours Powered by phpBB Forum Software © phpBB Group