I am trying to compile a huge program I have been porting from arduino to photon.
I was using web ide for checking examples and small parts of code which I wasn’t sure they would work and particle dev for my whole program.
It seems to compile fine until I added the last 2 or 3 files (http library) then I started to get (just compiling, I never tried to upload code from here) the message: “build didn’t produce any binary bla bla bla.” so I tried to compile locally in a virtual machine I created with ubuntu and with all CLI tools instaled.
I uploaded the firmware version of a photon device a couple of weeks ago with this virtual machine so I guess everything is installed fine.
So this is my folder structure:
I copied my program inside photonSketch folder and run:
particle compile photon .
and I get a bunch of errors. First line is:
I don’t know what this means.
Then I get a list with all my files: Including:…
And then tons of warnings from HttpClient library and TimeAlarms library. Both included in my sketch and both in the same folder.
After that, I get the list of errors. First declared here things and so on.
In this point, I guess I have to concepts mismatched.
I will try to explain the errors I get and how I have declared all elements.
For example, I have a .h file in which I have declared a structure to contain some arrays and data. I want to use this structure in all my functions as an argument, something like this:
For this, I have declared my structure in this .h file and then I have imported it in all files which have functions which use this struct.
I get no errors about that, so I think it is ok.
But, following the same pattern. I have an array which contains 5 elements. It is declared in the same .h file as follows:
Those PIN_REL_X are defined right before.
I am getting this errors for this array:
../../../build/target/user/platform-6/libuser.a(default.o):(.data.relayArrayPins+0x0): multiple definition of `relayArrayPins'
../../../build/target/user/platform-6/libuser.a(Main.o):(.data.relayArrayPins+0x0): first defined here
I can swear I haven’t declared this array in other file.
My params.h starts:
#ifndef __PARAMS_H__ #define __PARAMS_H__ and ends: #endif
Other example is about DS18B20 and dht classes. I have 2 files: sensor.h and sensor.cpp to store sensor related functions (getTemp, getHum…)
In my .h I have these lines before function declarations:
and then in my functions (in .cpp files) I use them like: dht.getTemp… or whatever.
I also get “multiple declaration in…”
I have a file called loop.cpp/loop.h in which I call a getTemperature function which is in sensor.cpp/sensor.h and contains ds18b20 instance. Maybe I have something wrong with my code structure.
I’d prefer not to post my whole code here since it is not mine and I am just helping to other person who prefers not to do it. But if you think it is mandatory, I will try to upload just enough examples to see my problem.