"" not declared in this scope, tried multiple fixes

Hi there. I am new to the forums and also new to arduino. I am building a weather station that will take readings from the spark fun weather shield and post them to the data.sparkfun website. I can get the weather shield code to run fine, and the arduino to connect to the internet using an XBee wifi chip on an arduino wireless SD shield. I have combined the two sets of code, and when verifying i get various errors. The most difficult ones seem to be that certain values are not declared in the scope. I have tried moving the troublesome section of code around and a few other fixes but to no avail. Any help is appreciated, my code is attached. Thanks in advance.

Weather_plus_wifi_for_the_forum.ino (17.8 KB)

Post the output. Many of us answer forum questions while on the road (phone, or systems not our development system), and you greatly shrink the pool of people who can and are willing to help if you force us to compile your code to find out what problem you're having.

"x was not declared in this scope" means you're referring to a variable of that name ("x" in this example), but you have never declared that variable, or you declared it in one place, but it's not in scope from the place you're trying to use it.

You must declare all variables before you use them.

Thank you for the quick reply. By posting the output what exactly do you mean? I wanted to post the code in a way that could be read without opening the actual code itself but i was unsure of how to do this. With declaring the variables, i would have to do this at the beginning of the code correct? Thanks

Please post the entire error message.

connor_gardner: . . . I wanted to post the code in a way that could be read without opening the actual code itself . . .

Use code tags as below but without embedded spaces:

[ code ]

my code here

[ /code ]

Here is the entire error message:

Arduino: 1.6.7 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/ConnorGardner/Documents/Arduino/Weather_plus_wifi/Weather_plus_wifi.ino: In function 'void setup()': Weather_plus_wifi:181: error: 'connectwifi' was not declared in this scope connectwifi(WIFI_SSID, WIFI_EE, WIFI_PSK); ^ Weather_plus_wifi:188: error: 'setupHTTP' was not declared in this scope setupHTTP(destIP); ^ Weather_plus_wifi:193: error: 'sendData' was not declared in this scope if (sendData()) ^ /Users/ConnorGardner/Documents/Arduino/Weather_plus_wifi/Weather_plus_wifi.ino: In function 'void loop()': Weather_plus_wifi:206: error: 'sendData' was not declared in this scope if (sendData()) ^ Weather_plus_wifi:216: error: 'get_wind_speed' was not declared in this scope float currentSpeed = get_wind_speed(); ^ Weather_plus_wifi:218: error: 'get_wind_direction' was not declared in this scope int currentDirection = get_wind_direction(); ^ Weather_plus_wifi:240: error: expected initializer before 'float' float temp = 0; ^ Weather_plus_wifi:242: error: passing 'const String' as 'this' argument of 'String& String::operator+=(unsigned char)' discards qualifiers [-fpermissive] temp += windspdavg*;* * ^* Weather_plus_wifi:243: error: no match for 'operator/=' (operand types are 'const String' and 'double') * temp /= 120.0;* * ^* Weather_plus_wifi:244: error: cannot convert 'const String' to 'float' in assignment * windspdmph_avg2m = temp;* * ^* Weather_plus_wifi:273: error: passing 'const String' as 'this' argument of 'String& String::operator=(StringSumHelper&&)' discards qualifiers [-fpermissive] * humidity = myHumidity.readHumidity();* * ^* Weather_plus_wifi:292: error: a function-definition is not allowed here before '{' token { ^ Weather_plus_wifi:314: error: a function-definition is not allowed here before '{' token { ^ Weather_plus_wifi:350: error: a function-definition is not allowed here before '{' token { ^ Weather_plus_wifi:599: error: expected '}' at end of input } ^ Weather_plus_wifi:599: error: expected '}' at end of input exit status 1 'connectwifi' was not declared in this scope * This report would have more information with* * "Show verbose output during compilation"* * enabled in File > Preferences.*

That’s usually indicative of a library not being in the correct place.
Where did you install the library for that code?
You can put it in the same folder as your code, using “library_name.h”
instead of <library_name.h>

I saved the libraries for my code to my arduino folder in my “documents” folder. All of my arduino stuff is there. I tried replacing the <> with “” and the problem still exists

The library needs to be in the right place or it won't be found. What OS are you using? Which version of the Arduino IDE?

ie libraries should be in /Users/ConnorGardner/Documents/Arduino/libraries//

Does this include the built in libraries like "WiFi" and "SoftwareSerial" ? I can't seem to find those ones in my library folder but it does say that they are installed

Hi,

Those are installed with the IDE in a different place from the user-installable libraries.

–Michael