'mask' was not declared in this scope

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
davidwhiteman
 
Posts: 11
Joined: Tue Jan 03, 2012 12:43 pm

'mask' was not declared in this scope

Post by davidwhiteman »

I am following the tutorial for the GPS data logger and am on the page http://www.ladyada.net/make/gpsshield/gpstest.html where I have downloaded the NewSoftSerial library to the libraries folder and have downloaded the GPStest_RMC sketch to a folder in the same directory in which the libraries folder is kept . When I try to verify the sketch or upload it to the Arduino I get a message that it has encountered errors in compiling, as follows:

/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:39:24: error: WConstants.h: No such file or directory
In file included from /Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:41:
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.h:71: error: conflicting return type specified for 'virtual void NewSoftSerial::write(uint8_t)'
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp: In member function 'void NewSoftSerial::tx_pin_write(uint8_t)':
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:291: error: 'LOW' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp: In member function 'void NewSoftSerial::setTX(uint8_t)':
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:368: error: 'OUTPUT' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:368: error: 'pinMode' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:369: error: 'HIGH' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:369: error: 'digitalWrite' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:370: error: 'digitalPinToBitMask' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:371: error: 'digitalPinToPort' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:372: error: 'portOutputRegister' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp: In member function 'void NewSoftSerial::setRX(uint8_t)':
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:377: error: 'INPUT' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:377: error: 'pinMode' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:379: error: 'HIGH' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:379: error: 'digitalWrite' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:381: error: 'digitalPinToBitMask' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:382: error: 'digitalPinToPort' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:383: error: 'portInputRegister' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp: In member function 'virtual void NewSoftSerial::write(uint8_t)':
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:472: error: 'HIGH' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:472: error: 'LOW' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:478: error: 'byte' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:478: error: expected `;' before 'mask'
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:478: error: 'mask' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:492: error: 'byte' was not declared in this scope
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:492: error: expected `;' before 'mask'
/Users/dave/Documents/Arduino/libraries/NewSoftSerial/NewSoftSerial.cpp:492: error: 'mask' was not declared in this scope

Do I have some problem with the NewSoftSerial library?

-Dave

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: 'mask' was not declared in this scope

Post by adafruit_support_bill »

What operating system are you using?
And what version of the IDE?

davidwhiteman
 
Posts: 11
Joined: Tue Jan 03, 2012 12:43 pm

Re: 'mask' was not declared in this scope

Post by davidwhiteman »

MacOS 10.7.2 and Arduino 1.0

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: 'mask' was not declared in this scope

Post by adafruit_support_bill »

Make sure you have the latest versions of all the libraries. There were some changes in IDE 1.0 that affected most libraries.
Also make sure that the capitalization in your #includes matches the actual file name. I believe the MacOS file system is case-sensitive.

davidwhiteman
 
Posts: 11
Joined: Tue Jan 03, 2012 12:43 pm

Re: 'mask' was not declared in this scope

Post by davidwhiteman »

Thanks for the advice. I downloaded the latest versions of the software, as follows:

From http://arduiniana.org/libraries/newsoftserial/
downloaded
NewSoftSerial10c.zip
and uploaded the files to my libraries folder

http://arduino.cc/en/Main/Software
downloaded fresh version of Arduino 1.0 from the MacOSX link.

I still get the same errors when following the tutorial to upload GPStest_RMC to the Arduino board. The first error message seems to be saying that the include file WConstants.h cannot be found where referenced from NewSoftSerial.cpp (or GPStest_RMC).

I would like to follow your second suggestion to see if there are any #include file name capitalization issues between the lines of code in GPStest_RMC or NewSoftSerial and the .h files, but I am a newbie and do not know where those .h files are located. I suppose that they must be installed somewhere in the Mac operating system when Arduino 1.0 is installed. How can I find them?

-Dave

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: 'mask' was not declared in this scope

Post by adafruit_support_bill »

The NewSoftSerial library was incorporated into the 1.0 release of the IDE. The documentation is here: http://arduino.cc/hu/Reference/SoftwareSerial

Change your #include of NewSoftSerial to

Code: Select all

 #include <SoftwareSerial.h>.

davidwhiteman
 
Posts: 11
Joined: Tue Jan 03, 2012 12:43 pm

Re: 'mask' was not declared in this scope

Post by davidwhiteman »

Thanks for the advice. I found that I could get the GPStest_RMC sketch to compile if I omitted the two if-then-else loops at the beginning of the program that checked to see if the sketchbook was version 1.0 or greater and replaced them with the following code:

#include "Arduino.h"
#include "SoftwareSerial.h"
SoftwareSerial mySerial = SoftwareSerial(2, 3);

Somehow the if-then-else loops did not test properly to find that I was using Arduino 1.0 and consequently it invoked the #include WProgram.h and the #include NewSoftSerial.h. It wasn't able to compile with these include statements. The problem didn't seem to be a capitalization problem with the test variable in the loop, as the loop failed when I used ARDUINO, arduino, and Arduino. I am using MacOS 10.7.2, R2 of the Arduino board and v 1.0 of the sketchbook.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”