View previous topic :: View next topic |
Author |
Message |
afk_pic
Joined: 02 Jun 2020 Posts: 19
|
Error expectating a identifier with FsFat |
Posted: Tue Sep 01, 2020 12:36 am |
|
|
Hello, I'm trying to port FsFat to CCS compiler and I can't be able to achieve this. I'm struggling with two errors and i don't know how to resolve...please if anyone have a idea, very apreciated!
Code: |
Compiling newmainXC16.c...
*** Error 28 "C:\Repositorios\microSDbase\source\FsFat\ff.h" Line 57(22,27): Expecting an identifier
*** Error 43 "C:\Repositorios\microSDbase\source\FsFat\ff.h" Line 57(26,27): Expecting a declaration
C:\Repositorios\microSDbase\source\newmainXC16.o ===> 2 Errors, 0 Warnings.
|
..and the portion of code...
Quote: |
/* Integer types used for FatFs API */
#if defined(_WIN32) /* Main development platform */
#define FF_INTDEF 2
#include <windows.h>
typedef unsigned __int64 QWORD;
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */
#define FF_INTDEF 2
#include <stdint.h>
//typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
//typedef unsigned char BYTE; /* char must be 8-bit */
typedef uint16_t WORD; /* 16-bit unsigned integer */
typedef uint32_t DWORD; /* 32-bit unsigned integer */
typedef uint64_t QWORD; /* 64-bit unsigned integer */
typedef WORD WCHAR; /* UTF-16 character type */
#else /* Earlier than C99 */
#define FF_INTDEF 1
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
typedef unsigned char BYTE; /* char must be 8-bit */
typedef unsigned short WORD; /* 16-bit unsigned integer */
typedef unsigned long DWORD; /* 32-bit unsigned integer */
typedef WORD WCHAR; /* UTF-16 character type */
#endif
|
Gives me error on line 55, is the line selected. Notice, that with XC16 compiler works fine and i can write/read files on sd card.
REgards! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19518
|
|
Posted: Tue Sep 01, 2020 1:29 am |
|
|
There is an issue in the line you post, that 'byte' is already a defined type.
It's #defined as an unsigned int8 in the processor include file.
Trying to typedef, with this keyword, will result in the line being seen
as:
typedef unsigned char unsigned int8;
which is not syntactically usable.... :(
Get rid of the line. BYTE already exists. |
|
|
afk_pic
Joined: 02 Jun 2020 Posts: 19
|
|
Posted: Tue Sep 01, 2020 1:59 am |
|
|
Ttelmah wrote: | There is an issue in the line you post, that 'byte' is already a defined type.
It's #defined as an unsigned int8 in the processor include file.
Trying to typedef, with this keyword, will result in the line being seen
as:
typedef unsigned char unsigned int8;
which is not syntactically usable.... :(
Get rid of the line. BYTE already exists. |
I suspect that... If I comment these line, gives me a dozens of errors...I'm replaced all BYTE for BYTEfsfat, and give same dozens of erros... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19518
|
|
Posted: Tue Sep 01, 2020 2:11 am |
|
|
Seriously, if you are moving the code from XC16 to CCS, you are adding
the #include for the processor settings, before trying to use these files?.
Also, you appear to be trying to compile using MPLAB?. If so, use the
CCS way of doing this, and only have the main code file in the 'source
files' tab, and have this #include everything else. Have the other files
only in the header files tab.
Otherwise you will get innumerable errors. |
|
|
afk_pic
Joined: 02 Jun 2020 Posts: 19
|
|
Posted: Tue Sep 01, 2020 2:42 am |
|
|
Hello,
yes i'm including all these #includes. Using eclipse to compile.
Anyway thanks |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19518
|
|
Posted: Tue Sep 01, 2020 3:06 am |
|
|
The point is that this line:
C:\Repositorios\microSDbase\source\newmainXC16.o ===> 2 Errors, 0 Warnings.
Says you are compiling to a .o file, not directly to hex
This is a mode of operation, that CCS 'supports', but does not really 'like'.
You are asking for problems. |
|
|
|