Error Cloud Compiling code that used to compile

I have some code I wrote about a year ago, compiled on 2.0.0, and it's working on a device.

I opened up the code in workbench and attempted to cloud compile with 5.8.0 and it fails. Same error if I try 2.0.0 again.

I am using a couple libraries, and updated them after I got the errors (via >particle install library)

The errors I am getting seem deep in the libraries. I know this sometimes shows up when you have bad brackets or semicolons, but I can't find any.

output with the errors:

In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/vector:67,
                 from lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.h:7,
                 from src/LED_Sign.ino:30:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_vector.h:1477:23: error: macro "swap" requires 2 arguments, but only 1 given
 1477 |       swap(vector& __x) _GLIBCXX_NOEXCEPT
      |                       ^
In file included from src/LED_Sign.ino:27:
lib/Adafruit_GFX/src/Adafruit_GFX.h:7: note: macro "swap" defined here
    7 | #define swap(a, b) { int16_t t = a; a = b; b = t; }
      | 
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/vector:67,
                 from lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.h:7,
                 from src/LED_Sign.ino:30:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_vector.h:1936:60: error: macro "swap" passed 4 arguments, but takes just 2
 1936 |     swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)
      |                                                            ^
In file included from src/LED_Sign.ino:27:
lib/Adafruit_GFX/src/Adafruit_GFX.h:7: note: macro "swap" defined here
    7 | #define swap(a, b) { int16_t t = a; a = b; b = t; }
      | 
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/vector:67,
                 from lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.h:7,
                 from src/LED_Sign.ino:30:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_vector.h:1937:49: error: macro "swap" requires 2 arguments, but only 1 given
 1937 |     _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
      |                                                 ^
In file included from src/LED_Sign.ino:27:
lib/Adafruit_GFX/src/Adafruit_GFX.h:7: note: macro "swap" defined here
    7 | #define swap(a, b) { int16_t t = a; a = b; b = t; }
      | 
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/vector:67,
                 from lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.h:7,
                 from src/LED_Sign.ino:30:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_vector.h:1938:19: error: macro "swap" requires 2 arguments, but only 1 given
 1938 |     { __x.swap(__y); }
      |                   ^
In file included from src/LED_Sign.ino:27:
lib/Adafruit_GFX/src/Adafruit_GFX.h:7: note: macro "swap" defined here
    7 | #define swap(a, b) { int16_t t = a; a = b; b = t; }
      | 
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/vector:68,
                 from lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.h:7,
                 from src/LED_Sign.ino:30:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_bvector.h:962:23: error: macro "swap" requires 2 arguments, but only 1 given
  962 |       swap(vector& __x) _GLIBCXX_NOEXCEPT
      |                       ^
In file included from src/LED_Sign.ino:27:
lib/Adafruit_GFX/src/Adafruit_GFX.h:7: note: macro "swap" defined here
    7 | #define swap(a, b) { int16_t t = a; a = b; b = t; }
      | 
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/vector:67,
                 from lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.h:7,
                 from src/LED_Sign.ino:30:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_vector.h:1477:7: error: variable or field 'swap' declared void
 1477 |       swap(vector& __x) _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_vector.h:1477:7: error: expected ';' at end of member declaration
 1477 |       swap(vector& __x) _GLIBCXX_NOEXCEPT
      |       ^~~~
      |           ;
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/type_traits:38,
                 from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/ratio:38,
                 from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/chrono:38,
                 from ./inc/application.h:33,
                 from src/LED_Sign.cpp:1:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_vector.h:1477:25: error: expected unqualified-id before 'noexcept'
 1477 |       swap(vector& __x) _GLIBCXX_NOEXCEPT
      |                         ^~~~~~~~~~~~~~~~~
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_vector.h:1937:5: error: expected initializer before 'noexcept'
 1937 |     _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
      |     ^~~~~~~~~~~~~~~~~~~~
In file included from src/LED_Sign.ino:27:
lib/Adafruit_GFX/src/Adafruit_GFX.h:7:20: error: expected unqualified-id before '{' token
    7 | #define swap(a, b) { int16_t t = a; a = b; b = t; }
      |                    ^
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/vector:68,
                 from lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.h:7,
                 from src/LED_Sign.ino:30:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_bvector.h:118:48: error: expected unqualified-id before 'noexcept'
  118 |   swap(_Bit_reference __x, _Bit_reference __y) noexcept
      |                                                ^~~~~~~~
In file included from src/LED_Sign.ino:27:
lib/Adafruit_GFX/src/Adafruit_GFX.h:7:20: error: expected unqualified-id before '{' token
    7 | #define swap(a, b) { int16_t t = a; a = b; b = t; }
      |                    ^
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/vector:68,
                 from lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.h:7,
                 from src/LED_Sign.ino:30:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_bvector.h:126:39: error: expected unqualified-id before 'noexcept'
  126 |   swap(_Bit_reference __x, bool& __y) noexcept
      |                                       ^~~~~~~~
In file included from src/LED_Sign.ino:27:
lib/Adafruit_GFX/src/Adafruit_GFX.h:7:20: error: expected unqualified-id before '{' token
    7 | #define swap(a, b) { int16_t t = a; a = b; b = t; }
      |                    ^
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/vector:68,
                 from lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.h:7,
                 from src/LED_Sign.ino:30:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_bvector.h:134:39: error: expected unqualified-id before 'noexcept'
  134 |   swap(bool& __x, _Bit_reference __y) noexcept
      |                                       ^~~~~~~~
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_bvector.h:962:7: error: variable or field 'swap' declared void
  962 |       swap(vector& __x) _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_bvector.h:962:7: error: expected ';' at end of member declaration
  962 |       swap(vector& __x) _GLIBCXX_NOEXCEPT
      |       ^~~~
      |           ;
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/type_traits:38,
                 from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/ratio:38,
                 from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/chrono:38,
                 from ./inc/application.h:33,
                 from src/LED_Sign.cpp:1:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_bvector.h:962:25: error: expected unqualified-id before 'noexcept'
  962 |       swap(vector& __x) _GLIBCXX_NOEXCEPT
      |                         ^~~~~~~~~~~~~~~~~
In file included from src/LED_Sign.ino:27:
lib/Adafruit_GFX/src/Adafruit_GFX.h:7:20: error: expected unqualified-id before '{' token
    7 | #define swap(a, b) { int16_t t = a; a = b; b = t; }
      |                    ^
In file included from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/type_traits:38,
                 from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/ratio:38,
                 from /usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/chrono:38,
                 from ./inc/application.h:33,
                 from src/LED_Sign.cpp:1:
/usr/local/gcc-arm-embedded/arm-none-eabi/include/c++/9.2.1/bits/stl_bvector.h:974:42: error: expected unqualified-id before 'noexcept'
  974 |       swap(reference __x, reference __y) _GLIBCXX_NOEXCEPT
      |                                          ^~~~~~~~~~~~~~~~~
src/LED_Sign.ino: In function 'void matrix_test()':
src/LED_Sign.ino:455:7: warning: unused variable 'textWidth' [-Wunused-variable]
  455 |   int textWidth = 6 * message.length();
      |       ^~~~~~~~~
src/LED_Sign.ino: At global scope:
src/LED_Sign.ino:34:12: warning: 'revision_version' defined but not used [-Wunused-variable]
   34 | static int revision_version = 0001;
      |            ^~~~~~~~~~~~~~~~
src/LED_Sign.ino:33:12: warning: 'minor_version' defined but not used [-Wunused-variable]
   33 | static int minor_version = 0001;
      |            ^~~~~~~~~~~~~
src/LED_Sign.ino:32:12: warning: 'major_version' defined but not used [-Wunused-variable]
   32 | static int major_version = 0000;
      |            ^~~~~~~~~~~~~
../build/module.mk:274: recipe for target '../build/target/user/platform-12-msrc/LED_Sign.o' failed
make[2]: *** [../build/target/user/platform-12-msrc/LED_Sign.o] Error 1
make[2]: Leaving directory '/firmware/user'
../../../build/recurse.mk:11: recipe for target 'user' failed
make[1]: Leaving directory '/firmware/modules/argon/user-part'
make[1]: *** [user] Error 2
../build/recurse.mk:11: recipe for target 'modules/argon/user-part' failed
make: *** [modules/argon/user-part] Error 2
	at makeError (c:\Users\micro\.vscode\extensions\particle.particle-vscode-core-1.16.20\node_modules\execa\lib\error.js:59:11)
	at handlePromise (c:\Users\micro\.vscode\extensions\particle.particle-vscode-core-1.16.20\node_modules\execa\index.js:114:26)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

The version of Adafruit_GFX you are using is very old. The old versions define a macro swap() which conflicts with the standard C++ library std::vector.

The version in Adafruit_GFX_RK is a newer version that will not conflict with std::vector. Uninstall the GFX library you are using and install Adafruit_GFX_RK instead. There is also a possibility that it's included by a library you include, which will be more difficult to fix.

That seems to have cleared some errors, but I am still getting errors in Adafruit_GFX, parts of which seem to be installed with Adafruit_GFX_RK.

I have uninstalled my tool chains, maybe something was cached?

Trying again...

Now problem with Neopixel?

Is it possible there is a caching error? If so, how would I flush it out?

../build/target/user/platform-12-mneopixel/src/neopixel.o lib/neopixel/src/neopixel.cpp
lib/neopixel/src/neopixel.cpp:67:30: error: 'HAL_Pin_Map' was not declared in this scope; did you mean 'Hal_Pin_Map'?
   67 |   NRF5x_Pin_Info* PIN_MAP2 = HAL_Pin_Map();
      |                              ^~~~~~~~~~~
      |                              Hal_Pin_Map
make[2]: *** [../build/target/user/platform-12-mneopixel/src/neopixel.o] Error 1
make[2]: Leaving directory `/firmware/user'
make[1]: *** [user] Error 2
make[1]: Leaving directory `/firmware/modules/argon/user-part'
make: *** [modules/argon/user-part] Error 2
	at makeError (c:\Users\micro\.vscode\extensions\particle.particle-vscode-core-1.16.20\node_modules\execa\lib\error.js:59:11)
	at handlePromise (c:\Users\micro\.vscode\extensions\particle.particle-vscode-core-1.16.20\node_modules\execa\index.js:114:26)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Why am I seeing the Adafruit_GFX path when I don't even have that anymore in my project?

lib/Adafruit_GFX/src/Adafruit_GFX.cpp
lib/Adafruit_GFX/src/Adafruit_GFX.cpp:36: warning: "pgm_read_byte" redefined
   36 | #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
      | 
In file included from ./inc/application.h:95,
                 from lib/Adafruit_GFX/src/Adafruit_GFX.h:4,
                 from lib/Adafruit_GFX/src/Adafruit_GFX.cpp:34:
../wiring/inc/spark_wiring_arduino.h:60: note: this is the location of the previous definition
   60 | #define pgm_read_byte(x)      (*(x))
      | 

Aaaahhhh. I will look for it.

It looks like the old Adafruit_GFX is imported by Adafruit_GFX_RK.

image

But also... I am using the Adafruit_GFX_RK in another project and I am not getting Adafruit_GFX Errors.

If you have any ideas why this doesn't work, please let me know.

Right now I am gonna assume some kind of Voodoo and create a new project, importing the RK versions from the start and seeing if I can get something simple to compile. That has worked a couple times in the past.

I would, however, like to learn why this might be happening.

I just realized you tried to help me with this several years ago. I don't know how it started working back then, the literal same code on this machine and on the cloud is failing.

OK, i reverted all those changes... I can compile locally with the old libraries (OS 2.0.0, 2.3.1, and 5.6.0). That must be how I made it work.

I appreciate you listening to all this!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.