Compiling Errors with Sensirion Temp/Humidity Sensor NonBlocking Example

Hello,

I am running the example code from the Sensirion Library example, and getting a series of compile errors relating to the following header files: Wstring, Arduino, stdlib. I have already changed the #include "WConstants.h" to #include "Arduino.h".

Errors shown below show conflicts between lines 115-121 in WString.h, lines 195 and 194 in Arduino.h, line 205 in Arduino.h and line 504 in stdlib.h, and lines 206 and 205 in Arduino.h. Do I need to go through and change all of these datatypes? Won't that screw me up down the road with other sketches?

Errors (Example code was too many characters long for the forum, and is attached to this post):

In file included from C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:191,
from C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\libraries\Sensirion\Sensirion.cpp:25:
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:116: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, const char*)' conflicts with
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:115: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const String&)' here
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:117: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, char)' conflicts with
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:116: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const char*)' here
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:118: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, unsigned char)' conflicts with
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:117: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, char)' here
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:119: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, int)' conflicts with
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:118: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, unsigned char)' here
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:120: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, unsigned int)' conflicts with
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:119: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, int)' here
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:121: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, long int)' conflicts with
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:120: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, unsigned int)' here
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:122: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, long unsigned int)' conflicts with
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/WString.h:121: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, long int)' here

In file included from C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\libraries\Sensirion\Sensirion.cpp:25:
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:195: error: declaration of C function 'uint16_t makeWord(byte, byte)' conflicts with
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:194: error: previous declaration 'uint16_t makeWord(uint16_t)' here
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:205: error: declaration of C function 'long int random(long int)' conflicts with
c:/documents and settings/kai/my documents/dropbox/school/arduino-1.0/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:504: error: previous declaration 'long int random()' here
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:206: error: declaration of C function 'long int random(long int, long int)' conflicts with
C:\Documents and Settings\Kai\My Documents\Dropbox\school\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:205: error: previous declaration 'long int random(long int)' here

NonBlocking.pde (6.56 KB)

Do I need to go through and change all of these datatypes?

Possibly

Won't that screw me up down the road with other sketches?

Possibly

Does the code work on 0.22 or 0.23 ? or phrased otherwise: is it caused by the fact that the sample code wasn't made for 1.0?

I hadn't tried it in a previous version because it was updated by the author less than a week ago, so I just figured it should be good to go. I'm downloading v0.23 now, and will try the example in there.

If I have to move the target project to 0.23, what functionality could I loose if any?

No compiling issues in V0.23.

I would really prefer to keep this in 1.0 though. Does any one have an idea that doesn't involve editing the headers and source files, or is that my only option?

Thanks!

Does any one have an idea that doesn't involve editing the headers and source files, or is that my only option?

You have one choice.

I guess so, because my sketch doesn't work in .23. I just get a bunch of "ààà" on the serial monitor now. :stuck_out_tongue_closed_eyes:

Got it...

#include "Arduino.h" was mistakenly placed (probably by me) inside of Extern"C"{} in Sensirion.cpp

The example compiles now.

Thanks!