-1

I am using IAR embedded workbench software for ARM CORTEX M7 controller. I have already included stdio.h library and it have fopen function like this enter image description here

but when i am declaring my file pointer like this

FILE *fpointer;

Its giving me these two errors.

enter image description here

Please share your experience how can i fix it?

Duck Dodgers
  • 3,409
  • 8
  • 29
  • 43
Ati
  • 43
  • 5
  • 3
    Please create a [mcve] of your code to show us. And copy-paste the errors from that code, as text, in full and complete into the question. – Some programmer dude Jan 14 '19 at 10:19
  • 1
    .h file is not a library. – 0___________ Jan 14 '19 at 10:25
  • I'd check the header file for `#if` and `#ifdef` to see if there are some conditional rules that mean you aren't getting the declaration. You could try adding an `#error` line just above the FILE declaration in stdio.h too to see if you hit it, and/or at the top of the file to verify this is the right one that's getting included. – Rup Jan 14 '19 at 10:25
  • 2
    Probably you have to tell the compiler to use full ISO C libraries or such. Since stdio.h isn't usually used for embedded systems - the compiler could be in "freestanding mode" by default, in which case it doesn't have to provide PC programming libraries. – Lundin Jan 14 '19 at 10:30

1 Answers1

4

File I/O is not present in the default library. To enable it you need to tell the compiler to use full libraries. This is done by opening the project options and choosing "Full" in the "Library Options" tab if you are using the IDE or by using the command line option --dlib_config full if you are using the command line compiler.

In addition, unless you are ok with using semihosting for input and output, you need to implement the low level I/O interface for your target.

Johan
  • 3,667
  • 6
  • 20
  • 25
  • Also, it's likely that low level I/O functions like `__open` and `__read` have to be implemented by the user. – user694733 Jan 14 '19 at 11:33