Compiling code to OS2.0.0-rc.1

I’m trying to compile my code to OS2.0.0-rc.1 and am getting a bunch of new errors compared to compiling to OS1.5.1. In particular, I’m getting this error and not sure how to fix. Does anyone have an idea how to fix it?

/usr/local/gcc-arm-embedded/arm-none-eabi/include/math.h: At global scope:
Pixels.h:81:29: error: expected ')' before '(' token
   81 | #define round(X) ((uint16_t)(((float)(X))+0.5))
      |                  ~          ^

Looks like it has something to do with the new sleep code/modes.

Are you using Sleep in your code?

these would be unrealted to sleep modes it the compiler causing errors. below is the error that i cant figure out how to fix so it compiles

/usr/local/gcc-arm-embedded/arm-none-eabi/include/math.h: At global scope:
Pixels.h:81:29: error: expected ')' before '(' token
   81 | #define round(X) ((uint16_t)(((float)(X))+0.5))
      |                  ~          ^

this is the code surrounding the errored line
image

Weird.

I could have sworn the error screen shot you posted had info about SleepMode errors.

I don’t think this is the entire error report :wink:

A wild guess would be that round() already exists in the global scope and hence “redefining” it may cause the issue.

That’s why #define should be avoided wherever possible.

1 Like

I searched the entire code for round(x) and theres no other definition for it. This compiled fine against OS1.5.1 but OS2.0.0 causes this error.

@ScruffR do you have any other thoughts on how to fix or define it differently?

I had another error refenecing a publish with “sleep” as the title, but i was able to fix that error so I removed it from this post.

1 Like

If you have a SHARE THIS REVISION link we may be able to look at that error in its natural habitat :wink:

would this be for the source code? or the CLI compiling?

tnx @ScruffR

This is a Web IDE feature and the easiest way to let someone else have a look at your project.

ahh right now its not on the web IDE, our code has over 50 addional .h and .cpp files

Are you compiling with gcc-arm 9.2.1 or 5.3.1?

Using deviceOS 2.0.0-rc.1 requires gcc-arm 9.2.1, so if you’re not using 9.2.1 it could be a contributing factor.

im using the CLI to compile, how can i check the version? @nrobinson2000

From the looks of where you have the toolchain installed you could probably run the arm-none-eabi-gcc executable directly to find the version:

/usr/local/gcc-arm-embedded/bin/arm-none-eabi-gcc --version

I just got back from holidays and tried to compile on (update VSC workbench) using 2.0.0-RC.1 - I get a number of warnings about sprintf and these errors:

In file included from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:36:
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.h:118:7: error: deleted function 'virtual Adafruit_SPITFT::~Adafruit_SPITFT()' overriding non-deleted function
  118 | class Adafruit_SPITFT : public Adafruit_GFX {
      |       ^~~~~~~~~~~~~~~
In file included from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.h:26,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:36:
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_GFX.h:13:7: note: overridden function is 'virtual Adafruit_GFX::~Adafruit_GFX()'
   13 | class Adafruit_GFX : public Print {
      |       ^~~~~~~~~~~~
In file included from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:36:
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.h:118:7: note: 'virtual Adafruit_SPITFT::~Adafruit_SPITFT()' is implicitly deleted because the default definition would be ill-formed:
  118 | class Adafruit_SPITFT : public Adafruit_GFX {
      |       ^~~~~~~~~~~~~~~
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.h:404:9: error: union member 'Adafruit_SPITFT::<unnamed union>::hwspi' with non-trivial 'Adafruit_SPITFT::<unnamed union>::<unnamed struct>::~<constructor>()'
  404 |       } hwspi;                     ///< Hardware SPI values
      |         ^~~~~
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp: In constructor 'Adafruit_SPITFT::Adafruit_SPITFT(uint16_t, uint16_t, int8_t, int8_t, int8_t)':
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:248:67: error: use of deleted function 'virtual Adafruit_SPITFT::~Adafruit_SPITFT()'
  248 |   int8_t dc, int8_t rst) : Adafruit_SPITFT(w, h, &SPI, cs, dc, rst) {

Guess this has something to do with the SPISettings class - clearly need to spend some effort to get things to recompile with the new device OS. I assume the libraries used in this case:

dependencies.Adafruit_GFX_RK=1.5.6
dependencies.SdFat=1.0.16

Also need to be remediated?

1 Like

I updated Adafruit_GFX_RK to version 1.5.8:

  • Fix compiler error for error: deleted function 'virtual Adafruit_SPITFT::~Adafruit_SPITFT()' overriding non-deleted function with 2.0.0-rc.1 caused by the new gcc compiler treating this as an error.

Also upgraded these libraries that use Adafruit_GFX_RK:

  • Adafruit_ILI9341_RK 1.2.3
  • Adafruit_LEDBackpack_RK 1.1.8
  • Adafruit_DotStarMatrix_RK 1.0.3
  • Adafruit_EPD_RK 2.3.1
  • Adafruit_HX8357_RK 1.0.10
  • Adafruit_SSD1306_RK 1.3.2
  • Adafruit_ST7735_RK 1.2.8
2 Likes

I am getting a lot of warnings:

In file included from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.h:26,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:36:
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_GFX.h:6: warning: "ARDUINO" redefined
    6 |  #define ARDUINO 157
      | 
In file included from ./inc/SPI.h:1,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.h:25,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:36:
./inc/Arduino.h:16: note: this is the location of the previous definition
   16 | #define ARDUINO 10800
      | 
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:563:5: warning: "SPI_INTERFACES_COUNT" is not defined, evaluates to 0 [-Wundef]
  563 | #if SPI_INTERFACES_COUNT > 0
      |     ^~~~~~~~~~~~~~~~~~~~
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:566:5: warning: "SPI_INTERFACES_COUNT" is not defined, evaluates to 0 [-Wundef]
  566 | #if SPI_INTERFACES_COUNT > 1
      |     ^~~~~~~~~~~~~~~~~~~~
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:569:5: warning: "SPI_INTERFACES_COUNT" is not defined, evaluates to 0 [-Wundef]
  569 | #if SPI_INTERFACES_COUNT > 2
      |     ^~~~~~~~~~~~~~~~~~~~
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:572:5: warning: "SPI_INTERFACES_COUNT" is not defined, evaluates to 0 [-Wundef]
  572 | #if SPI_INTERFACES_COUNT > 3
      |     ^~~~~~~~~~~~~~~~~~~~
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:575:5: warning: "SPI_INTERFACES_COUNT" is not defined, evaluates to 0 [-Wundef]
  575 | #if SPI_INTERFACES_COUNT > 4
      |     ^~~~~~~~~~~~~~~~~~~~
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-trolley-base/lib/Adafruit_GFX_RK/src/Adafruit_SPITFT.cpp:578:5: warning: "SPI_INTERFACES_COUNT" is not defined, evaluates to 0 [-Wundef]
  578 | #if SPI_INTERFACES_COUNT > 5
      |     ^~~~~~~~~~~~~~~~~~~~

Previously I have fixed these but just wondered when you compile whether you get the same ?

@rickkas7 Not sure if you saw this or not but I’m getting a hard error when compiling JsonParserGeneratorRK on 2.0.0-rc.1.

I did not see that, but the problem is that long long int (64-bit signed) is not a valid type to pass to insertValue. If you really need 64-bit support you’ll need to manually convert it. If the value isn’t really that long, you’ll need to cast to 32-bit value like long instead.