Go Down

Topic: Compile error with some of the addProperty function calls in thingProperties.h (Read 385 times) previous topic - next topic

markdanielarseneau

Hello,
in
I've started a new project on the MKR1010 board and part of that process included experimenting with adding "things" through the IoT cloud.

Everything was working fine a few days ago when I added both a boolean thing (the state of an LED) and the values returned from a DHT22 sensor (humidity and temperature).  Everything compiled, uploaded and updated cleanly until yesterday (March 28th, 2019) when I added some unrelated code and tried to compile.  I got the error during compile shown below.  I stripped out my new code thinking that was the issue, but it was not.

The issue is related to the addProperty function calls in the thingProperties.h library.  Specifically in my case when the function tries to pass a real number (float)

Note that the addProperty function call for the boolean operator works fine.  I experimented with removing all of the things and only leaving the boolean one and it compiled fine. As soon as the addProperty function is for a real number (float) it gives the compile error shown below. 

I am assuming these functions come from the ArduinoIoTCloud.h library.  Was something changed recently to that library that is causing this?

Compile error seen: 
************************************
Code: [Select]

In file included from /tmp/415556697/build/sketch/thingProperties.h:1:0,

from /tmp/415556697/Wifi_experiment_mar22a/Wifi_experiment_mar22a.ino:21:

/tmp/415556697/build/sketch/thingProperties.h: In function 'void initProperties()':

/home/builder/opt/libraries/latest/arduinoiotcloud_0_5_4/src/ArduinoIoTCloud.h:96:66: error: no matching function for call to 'ArduinoIoTCloudClass::addPropertyReal(float&, const char [15], permissionType, const long int&, NULL, double)'

#define addProperty( v, ...) addPropertyReal(v, #v, __VA_ARGS__)

^

/tmp/415556697/build/sketch/thingProperties.h:16:16: note: in expansion of macro 'addProperty'

ArduinoCloud.addProperty(DHT22_Humidity, READ, ON_CHANGE, NULL, 0.100000);

^

/home/builder/opt/libraries/latest/arduinoiotcloud_0_5_4/src/ArduinoIoTCloud.h:96:66: note: candidates are:

#define addProperty( v, ...) addPropertyReal(v, #v, __VA_ARGS__)

^

/tmp/415556697/build/sketch/thingProperties.h:16:16: note: in expansion of macro 'addProperty'

ArduinoCloud.addProperty(DHT22_Humidity, READ, ON_CHANGE, NULL, 0.100000);

^

/home/builder/opt/libraries/latest/arduinoiotcloud_0_5_4/src/ArduinoIoTCloud.h:103:8: note: template<class T, class N> void ArduinoIoTCloudClass::addPropertyReal(T&, String, permissionType, long int, void (*)(), void (*)(ArduinoCloudProperty<T>), N)

void addPropertyReal(T & property, String name, permissionType permission_type = READWRITE, long seconds = ON_CHANGE, void(*fn)(void) = NULL, void(*synFn)(ArduinoCloudProperty<T> property) = CLOUD_WINS, N minDelta = N(0)) {

^

/home/builder/opt/libraries/latest/arduinoiotcloud_0_5_4/src/ArduinoIoTCloud.h:103:8: note: template argument deduction/substitution failed:

/home/builder/opt/libraries/latest/arduinoiotcloud_0_5_4/src/ArduinoIoTCloud.h:96:66: note: mismatched types 'void (*)(ArduinoCloudProperty<T>)' and 'double'

#define addProperty( v, ...) addPropertyReal(v, #v, __VA_ARGS__)

^

/tmp/415556697/build/sketch/thingProperties.h:16:16: note: in expansion of macro 'addProperty'

ArduinoCloud.addProperty(DHT22_Humidity, READ, ON_CHANGE, NULL, 0.100000);

^

/home/builder/opt/libraries/latest/arduinoiotcloud_0_5_4/src/ArduinoIoTCloud.h:117:27: note: template<class T> ArduinoCloudProperty<T> ArduinoIoTCloudClass::addPropertyReal(T&, const String&, Permission)

ArduinoCloudProperty<T> addPropertyReal(T & property, String const & name, Permission const permission) {

^

/home/builder/opt/libraries/latest/arduinoiotcloud_0_5_4/src/ArduinoIoTCloud.h:117:27: note: template argument deduction/substitution failed:

/home/builder/opt/libraries/latest/arduinoiotcloud_0_5_4/src/ArduinoIoTCloud.h:96:66: note: cannot convert 'READ' (type 'permissionType') to type 'Permission'

#define addProperty( v, ...) addPropertyReal(v, #v, __VA_ARGS__)

^

/tmp/415556697/build/sketch/thingProperties.h:16:16: note: in expansion of macro 'addProperty'

ArduinoCloud.addProperty(DHT22_Humidity, READ, ON_CHANGE, NULL, 0.100000);

^

exit status 1

*****************************


NOTE:  I did try adding an integer based "thing" to see what would happen and it also threw a compile error, but it returned absolutely no related messages, only a message to report this to the forum.


I'd appreciate anyone's insight on what may be happening here.

Kind Regards,
-Mark-


Vleer


markdanielarseneau

Hello Vleer,

Thanks for sharing that you are seeing this issue as well.

Regards,
-Mark-

pert

This error appears to be caused by using an outdated version of the ArduinoIoTCloud library. From the library path in the output you shared, I can see that version 0.5.4 of the library is being used:
Code: [Select]
/home/builder/opt/libraries/latest/arduinoiotcloud_0_5_4/src/ArduinoIoTCloud.h:96:66: error: no matching function for call to 'ArduinoIoTCloudClass::addPropertyReal(float&, const char [15], permissionType, const long int&, NULL, double)'

#define addProperty( v, ...) addPropertyReal(v, #v, __VA_ARGS__)

^


I can reproduce the error with 0.5.4 but if I install the newest version of the library (0.5.6), the error does not occur. The 0.5.5 and 0.5.6 releases of the library were only made within the last day. I don't know, but I suspect it takes a little while for Arduino Web Editor to get the new library releases installed. So you have two options:
  • Wait for Arduino Web Editor to get the library update. I suspect it won't be a very long wait.
  • Use the Arduino IDE with the latest release of the ArduinoIoTCloud library. You can install it via Library Manager.

markdanielarseneau

Thanks for your comments, Pert.

I figured something had changed.  I'll look for a library update and see if that fixes the issue.

Regards,
-Mark-

pert

You're welcome. I just did a test compilation and Arduino Web Editor is still on version 0.5.4 of the library so the wait is not yet over.

mbertorello

Thanks Pert.
Now should be all right, the version on the Arduino Web Editor was updated.

Go Up