Auduino Compiling error : stdio.h



  • I am trying to run some example code for an NXP sensor on spresense, it will compile for a Arduino board with out erros, but when I try for Sprensence I get the following error:

    *\AppData\Local\Arduino15\packages\SPRESENSE\tools\spresense-sdk\1.0.0/spresense/release/nuttx/include/stdio.h:93:22: error: expected unqualified-id before 'void'

    #define rewind(s) ((void)fseek((s),0,SEEK_SET))

                    ^
    

    Any comments please of this if is an error in my code or and issue with the stdio.h file?


  • DeveloperWorld

    Hi @pnj

    It would help a lot if you could provide the code/sketch you are trying to build.
    Also, what sensor are you using? What libraries?

    BR
    Karl

    I tried the following code just to see if using the rewind macro would generate any error and it didn't:
    Using SDK 2.0.2

    void setup() {
      // put your setup code here, to run once:
    /* This code is just to test the build for errors. */
      FILE *fp = NULL;
      rewind(fp);
      
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
    
    }
    
    ####################################
    ## Used memory size:  768 [KByte] ##
    ####################################
    Sketch uses 159444 bytes (20%) of program storage space. Maximum is 786432 bytes.
    Global variables use 159444 bytes (20%) of dynamic memory, leaving 626988 bytes for local variables. Maximum is 786432 bytes.
    

    @pnj said in Auduino Compiling error : stdio.h:

    some example



  • @TE-KarlKomierowski Thank your reply. The senor is https://learn.adafruit.com/nxp-precision-9dof-breakout/overview, and I can run the basic application supplied for this board. However I am now trying to run the AHS code, and have start with the function "Adafruit_Sensor_Calibration.h". which is where I get this error.



  • I am trying to get a compass heading, or at least the heading in degrees.


  • DeveloperWorld

    @pnj Please comment line 25:

    // #include <stdio.h>
    

    in file: *\AppData\Local\Arduino15\packages\SPRESENSE\hardware\spresense<version>\cores\spresense\Print.h
    and add:

    #include <stdio.h>
    

    to file: *\AppData\Local\Arduino15\packages\SPRESENSE\hardware\spresense<version>\cores\spresense\main.cpp

    Let me know if it helped.



  • Sorry, has taken me time to get back to this problem, once I make the suggested change the error I got previously no longer appears when I compile the code. I now get other issues but that appears to be due to board differences.

    Thank you


Log in to reply