First time post, and new to Particle. My experience is in Arduino and I am excited to see the cross-over.
I am trying to get the Sinsirion SDP610 going on a Boron for a remote pressure monitoring project.
In Arduino I have used the following library successfully, but I am having trouble getting it to compile in Particle.
I created an App and I added the following files listed below directly from the github link above via the + button in the top right corner trying to provide the library files it would need to compile:
sdp610-presssure-v1.ino
inttypes.h
SDP6x.cpp
SDP6x.h
Wire.h
As a result I am getting a "SDP6x.h:41:13: redeclaration of ‘NO_ERROR’’ compile error.
Any help would be appreciated, and a big thank you already for all the community posts I have been soaking up already. Seems like there is tons of wisdom and experience on this forum!
Once you got a Web IDE project setup, you can use the SHARE THIS REVISION button for others to create a copy of your project to directly test without the need for them to collect all the files and copy/paste them themselves.
This makes helping you a lot easier
However, when you get a redeclaration error, you’d need to look where the other declaration comes from. That’s easierst done by hitting the SHOW RAW button in the error output window and read the compiler notes about the error.
Sometimes a simple #undef may solve the problem, other times you may need to rename the offending keyword.
If you are lucky, the value of both declarations is the same, then you can just drop one of them.
BTW, don’t include inttypes.h - it shouldn’t be required and if that header is not correctly guarded, you will create more troubles than you solve
The same goes for Wire.h.
You should only add #include <Particle.h> in your SDP6x.h and that should provide you with all integer types needed and the wire (aka I2C) library.
I tried a few things but just ended up with more errors.
I removed NO_Error in SDP6x.H and then replaced all instances of NO_Error in the .cpp file with 0 which is what NO_Error was programmed to be. That got rid of the re-declaration error but then I got a new error about undefined reference and gave up there due to a lack of free time.
@ScruffR and @RWB thank you very much for your replies.
Bottom line, I got it to work with your help. Here is what I did for reference:
-Removed inttypes.h file
-Removed Wire.h file
-Added #include <Particle.h> in SDP6x.h file
Still had the compile error, but RWB’s comment got me thinking, so I found the instances of NO_ERROR and changed it to NO_EROR (removed one R) and it compiled perfectly. My best guess is it was conflicting with an underlying declaration in background code.
Lastly, I will share my code file as suggested in future post, to make it easier for all.
Thank you both, I am going to get the hardware setup and give it a shot. I will update this post to confirm hardware and software success once I achieve it.