Help building with Xenon

Hi all. Sorry if my post leaves out anything as I am still new to all of this, but I’ve been having a bit of an issue that has been a pain for me.

In file included from ../wiring/inc/spark_wiring.h:51:0,
                 from ./inc/application.h:40,
                 from c:/ProjectStuff/MyProject//src/main.cpp:2:
../wiring/inc/spark_wiring_cloud.h: In instantiation of 'static bool CloudClass::function(const T&, Types ...) [with T = char [9]; Types = {void (*)(String)}]':
c:/ProjectStuff/MyProject//src/main.cpp:222:42:   required from here
../wiring/inc/spark_wiring_cloud.h:194:25: error: no matching function for call to 'CloudClass::_function(const char [9], void (*&)(String))'
         return _function(name, args...);
../wiring/inc/spark_wiring_cloud.h:197:17: note: candidate: static bool CloudClass::_function(const char*, int (*)(String)) <near match>
     static bool _function(const char *funcKey, user_function_int_str_t* func)
../wiring/inc/spark_wiring_cloud.h:197:17: note:   conversion of argument 2 would be ill-formed:
../wiring/inc/spark_wiring_cloud.h:194:25: error: invalid conversion from 'void (*)(String)' to 'int (*)(String)' [-fpermissive]
         return _function(name, args...);
../wiring/inc/spark_wiring_cloud.h:202:17: note: candidate: static bool CloudClass::_function(const char*, user_std_function_int_str_t, void*)
     static bool _function(const char *funcKey, user_std_function_int_str_t func, void* reserved=NULL)
../wiring/inc/spark_wiring_cloud.h:202:17: note:   no known conversion for argument 2 from 'void (*)(String)' to 'user_std_function_int_str_t {aka std::function<int(String)>}'
../wiring/inc/spark_wiring_cloud.h:220:17: note: candidate: template<class T> static bool CloudClass::_function(const char*, int (T::*)(String), T*)
     static bool _function(const char *funcKey, int (T::*func)(String), T *instance) {
../wiring/inc/spark_wiring_cloud.h:220:17: note:   template argument deduction/substitution failed:
../wiring/inc/spark_wiring_cloud.h:194:25: note:   mismatched types 'int (T::*)(String)' and 'void (*)(String)'
         return _function(name, args...);
make[3]: *** [../build/ ../build/target/user/platform-14-m/MyProject/src/main.o] Error 1
make[3]: Leaving directory '/cygdrive/c/Users/Me/.particle/toolchains/deviceOS/0.8.0-rc.27/firmware-0.8.0-rc.27/user'
make[2]: *** [../../../build/ user] Error 2
make[2]: Leaving directory '/cygdrive/c/Users/Me/.particle/toolchains/deviceOS/0.8.0-rc.27/firmware-0.8.0-rc.27/modules/xenon/user-part'
make[1]: *** [../build/ modules/xenon/user-part] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Me/.particle/toolchains/deviceOS/0.8.0-rc.27/firmware-0.8.0-rc.27/main'
make: *** [C:\Users\Work\.particle\toolchains\buildscripts\1.2.0\Makefile:38: compile-user] Error 2
The terminal process terminated with exit code: 2

Does anyone have any even basic ideas on why this would be thrown? It doesn’t appear to have much to do with my own code but I haven’t been able to root it out. Thanks! I can include some of my code if needed but I have no idea where it is coming from so I didn’t include anything in this post.

The most important bit you left out is the actual code that produced that error list.

The first error message complains that you are using Particle.function() with a callback function that’s not compatible to what the function expects.
Re-read the docs for Paricle.function()

Pay special attention to the examples and compare to your own callback function signature.

Okay. Looks like I got it! During my changes, I switched the particle function I was using from returning an int to void. Seems to have fixed my problems! Thanks!!

1 Like