MQX with MFS compile problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX with MFS compile problem

2,590 Views
geoffW
Contributor III

Hi

 

I am trying to integrate into MQX a quite complex 3rd party piece of code, this code requires me to use MFS for the file system but also requires me to include the standard header <stdio.h> .

 

Adding this header as shown below will cause a compile error even for the trivial example below

 

#include <stdio.h>  // Grrr this causes header clash#include "mqx.h"#include "fio.h"#include "mfs.h"void doSomething(void){}
Error   : identifier 'FILE' redeclared
was declared as: 'struct _FILE'
now declared as: 'struct file_struct'
fio.h line 153   } FILE, _PTR_ FILE_PTR;

To reduce the errors down to just this "FILE" variable clash I had to  declare the macro "MQX_SUPPRESS_STDIO_MACROS"

 

I have no idea how to fix this last error , can anyone suggest a tidy fix please ?  I tried kludging out the clashing item in "cstdio" but that didnt seem sensible and it triggered more compile faults  anyway.

 

Thanks for any suggestions

 

   Geoff

6 Replies

957 Views
jbezem
Contributor III

Not sure whether this is intentional, but when using MQX I restrict myself to that, and will not touch the stdio.h. As far as my code goes, MQX's fio.h offers all I/O functions I need, so I don't need stdio.h. YMMV

The only problem I can see is if you're forgetting to include fio.h, then the compiler will silently (unless you enable the warning about missing prototypes, which in 7.1 is treated as an error, therefore unusable in our code...) link with the std-library, and effectively insert two versions of the function, probably different ones.

I didn't look at the latest version of MQX in this respect yet, though.

 

FWIW,

 

Johan

0 Kudos

957 Views
solarhawk
Contributor I

What about snprintf and similar functions.  They don't seem to be available through fio.h.  If we want to use them from stdio.h how do we prevent the clash with MQX?

 

 

0 Kudos

957 Views
oldone1
Contributor II

I moved stdio.h to the top of my include list and things started working better, seems to be a IAR and MQX include file mix up.

Move the most important includes to the top, "IAR" and things should clear up.

 

 

957 Views
javax
Contributor I

Error compilation of mfs_sdcard_twrmcf51cn demo on CodeWarrior 10 Eclipse based

HI everybody
I have successfully compiled  and debugged many of example available for TWMCF51CN128.
I have been working with CodeWarrior 10 but during compilation of demo " mfs_sdcard_twrmcf51cn" a got this problems:
Description    Resource    Path    Location    Type
mfs_sdcard_twrmcf51cn     
Undefined : "Shell_cd"    mfs_sdcard_twrmcf51cn    
Undefined : "Shell_copy"    mfs_sdcard_twrmcf51cn      
Undefined : "Shell_create"    mfs_sdcard_twrmcf51cn      
Undefined : "Shell_del"    mfs_sdcard_twrmcf51cn     
Undefined : "Shell_dir"    mfs_sdcard_twrmcf51cn      
Undefined : "Shell_get_current_filesystem" Referenced from "Shell_disect" in    mfs_sdcard_twrmcf51cn     
Undefined : "Shell_mkdir"    mfs_sdcard_twrmcf51cn  

I really apreciate any help.
Thanks

0 Kudos

957 Views
JuroV
NXP Employee
NXP Employee

Rebuild shell library.

957 Views
javax
Contributor I

Thank you.

It seems to be importand the order libraries are compiled in.

0 Kudos