CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Error expectating a identifier with FsFat

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
afk_pic



Joined: 02 Jun 2020
Posts: 19

View user's profile Send private message

Error expectating a identifier with FsFat
PostPosted: Tue Sep 01, 2020 12:36 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 01, 2020 1:29 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 01, 2020 1:59 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 01, 2020 2:11 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 01, 2020 2:42 am     Reply with quote

Hello,

yes i'm including all these #includes. Using eclipse to compile.

Anyway thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Tue Sep 01, 2020 3:06 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group