Eralt / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

NewSoftSerial is broken (by String ?) in 0019rc1 #328

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create sketch:

#include <NewSoftSerial.h>
void setup() {
}
void loop() {
}

2. Compile.

What is the expected output? What do you see instead?

Expected output is a successful compilation.

Actual output is:

In file included from 
/.../Arduino-0019rc1.app/Contents/Resources/Java/hardware/arduino/cores/arduino/
WString.h:24,
                 from /.../Arduino-0019rc1.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:26,
                 from /.../Arduino/libraries/NewSoftSerial/NewSoftSerial.h:32,
                 from /.../Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:41:
/.../Arduino-0019rc1.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/g
cc/avr/4.3.2/../../../../avr/include/stdlib.h:111: error: expected 
unqualified-id before 'int'
/.../Arduino-0019rc1.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/g
cc/avr/4.3.2/../../../../avr/include/stdlib.h:111: error: expected `)' before 
'int'
/.../Arduino-0019rc1.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/g
cc/avr/4.3.2/../../../../avr/include/stdlib.h:111: error: expected `)' before 
'int'

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?

0019rc1, OS X 10.5, Deci

Please provide any additional information below.

This might be considered a problem with NSS rather than Arduino but it could 
also be considered a regression in Arduino given NSS hasn't changed. 
Potentially the root cause might also break other libraries. 

Original issue reported on code.google.com by follower@gmail.com on 15 Aug 2010 at 3:10

GoogleCodeExporter commented 9 years ago
The Print-class in 0019 was extened to work with WString-class instances.

Replacing 

#include "WConstants.h" with #include "WProgram.h"

in NewSoftSerial.cpp fixes the compile error at least. 

Original comment by e.fa...@wayoda.org on 15 Aug 2010 at 5:07

GoogleCodeExporter commented 9 years ago
r1073

We're now including stdlib.h in wiring.h so that the standard abs() comes 
before our abs() #define, and therefore isn't broken by it.  This seems to have 
fixed NewSoftSerial, and should hopefully prevent other similar problems.

Original comment by dmel...@gmail.com on 17 Aug 2010 at 9:54

GoogleCodeExporter commented 9 years ago
Yes this will fix it, but I'm just curious to know:
Is there a reason NewSoftSerial favors to include "WConstants.h" instead of 
"WProgram.h" (as suggested by the library tutorial 
http://arduino.cc/en/Hacking/LibraryTutorial )??
Right at the start "WProgram.h" does what now "wiring.h" does again, and 
codesize isn't affected either.

{{{
#ifndef WProgram_h
#define WProgram_h

#include <stdlib.h>
#include <string.h>
#include <math.h>

#include <avr/interrupt.h>

#include "wiring.h"
}}}
Eberhard

Original comment by e.fa...@wayoda.org on 18 Aug 2010 at 8:10

GoogleCodeExporter commented 9 years ago
I think there was an idea that WConstants.h would be a minimal header that 
would just define the appropriate types and constants, whereas WProgram.h would 
actually provide the core functions declarations.  That way, if you only needed 
the former, you wouldn't get the latter.  I doubt it makes any difference 
though.

Original comment by dmel...@gmail.com on 18 Aug 2010 at 3:30