Photon code declaration problem (compilation error)

Hi All,

I am trying to port my Core code over to the Photon I have run into a problem that I can’t seem to fix.

My code requires the use of system_task.cpp but when it is included in the build I get a compilation error. The line that causes the problem is

using spark::WiFi;

The message is “spark has not been declared”.

I did a file search through the repository for “spark::WiFi” the only place it shows up is system_task.cpp

Obviously I am much more of a C guy than CPP. Can you suggest what I am missing?

system_task.cpp is very much meant to be an internal part of the system - it’s already included in the system module. Including it in your application will only lead to bad things! :dizzy_face:

I’d like to know what your goals are so I can help you find an alternative route.

Hi @mdma,

Very simply I am just trying to get my code to compile (all of it). The driving factor in trying to include system_task.cpp into my code was that I was getting the error undefined reference “Spark_Idle_Events”. I was not trying to call anything directly in system_task.cpp just make it available to solve the “Spark_Idle_Events” problem.

For that matter I am not calling “Spark_Idle_Events” directly either not sure what old code is needing it.

Spark_Idle_Events() is an internal function that indirectly called from Spark.process(). I’ve tried with both modular and monolithic firmware and both link fine here.

Could you share your code and/or details about how you are building it so we can troubleshoot?

EDIT: I’ve reproduced the problem. Calls to the deprecated SPARK_WLAN_Loop() will cause this error. Please change those calls to Spark.process() and the problem will disappear!

I just pushed a fix to the develop branch, which will fix the linker error with SPARK_WLAN_Loop(), so the code will compile now.

Although it’s a good idea to change SPARK_WLAN_Loop() to Spark.process() :slight_smile:

Thanks @mdma,

Yup my code has SPARK_WLAN_Loop() I will swap it out as you suggest.