‘WiFi’ was not declared in this scope

  arduino, arduino-mkr1000, c++

Here is the code. If you need the link to the project.

#include "ArduinoIoTCloud.h"
#include "WiFiConnectionManager.h"

const char THING_ID[] = "97e8b9343-d81e-45d7-84bc-61eafe7cd9b7";
const char SSID[WiFi] = SECRET_SSID;    // Network SSID (name)//The error is here
const char PASS[[email protected]] = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

int Deliveries;

void initProperties()
{
    ArduinoCloud.setThingId(THING_ID);
    ArduinoCloud.addProperty(deliveries, READ, ON_CHANGE, NULL);
}

ConnectionManager* ArduinoIoTPreferredConnection = new WiFiConnectionManager(SSID, PASS);

The error is on line 4, any help will be appreciated. I just copied and pasted the code from a project online.

THE FULL ERROR:

Arduino: 1.8.15 (Mac OS X), Board: "Arduino MKR1000"

In file included from /Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino:17:0:
thingProperties.h:7:1: error: expected ',' or ';' before 'const'
 const char PASS[]     = "xxxx"    // Network password (use for WPA, or use as key for WEP)
 ^~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/thingProperties.h: In function 'void initProperties()':
thingProperties.h:13:3: error: 'ArduinoCloud' was not declared in this scope
   ArduinoCloud.setThingId(THING_ID);
   ^~~~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/thingProperties.h:13:3: note: suggested alternative: 'Arduino_h'
   ArduinoCloud.setThingId(THING_ID);
   ^~~~~~~~~~~~
   Arduino_h
thingProperties.h:14:28: error: 'deliveries' was not declared in this scope
   ArduinoCloud.addProperty(deliveries, READ, ON_CHANGE, NULL);
                            ^~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/thingProperties.h:14:28: note: suggested alternative: 'degrees'
   ArduinoCloud.addProperty(deliveries, READ, ON_CHANGE, NULL);
                            ^~~~~~~~~~
                            degrees
thingProperties.h:14:40: error: 'READ' was not declared in this scope
   ArduinoCloud.addProperty(deliveries, READ, ON_CHANGE, NULL);
                                        ^~~~
thingProperties.h:14:46: error: 'ON_CHANGE' was not declared in this scope
   ArduinoCloud.addProperty(deliveries, READ, ON_CHANGE, NULL);
                                              ^~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/thingProperties.h:14:46: note: suggested alternative: 'CHANGE'
   ArduinoCloud.addProperty(deliveries, READ, ON_CHANGE, NULL);
                                              ^~~~~~~~~
                                              CHANGE
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/thingProperties.h: At global scope:
thingProperties.h:17:1: error: 'ConnectionManager' does not name a type
 ConnectionManager *ArduinoIoTPreferredConnection = new WiFiConnectionManager(SSID, PASS);
 ^~~~~~~~~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino: In function 'void setup()':
MAILBOX_notifier:48:3: error: 'setDebugMessageLevel' was not declared in this scope
   setDebugMessageLevel(4);
   ^~~~~~~~~~~~~~~~~~~~
MAILBOX_notifier:49:3: error: 'ArduinoCloud' was not declared in this scope
   ArduinoCloud.printDebugInfo();
   ^~~~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino:49:3: note: suggested alternative: 'Arduino_h'
   ArduinoCloud.printDebugInfo();
   ^~~~~~~~~~~~
   Arduino_h
MAILBOX_notifier:52:22: error: 'ArduinoIoTPreferredConnection' was not declared in this scope
   ArduinoCloud.begin(ArduinoIoTPreferredConnection);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MAILBOX_notifier:61:2: error: 'deliveries' was not declared in this scope
  deliveries = 0;
  ^~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino:61:2: note: suggested alternative: 'degrees'
  deliveries = 0;
  ^~~~~~~~~~
  degrees
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino: In function 'void loop()':
MAILBOX_notifier:74:3: error: 'ArduinoCloud' was not declared in this scope
   ArduinoCloud.update();
   ^~~~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino:74:3: note: suggested alternative: 'Arduino_h'
   ArduinoCloud.update();
   ^~~~~~~~~~~~
   Arduino_h
MAILBOX_notifier:117:5: error: 'deliveries' was not declared in this scope
     deliveries++;
     ^~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino:117:5: note: suggested alternative: 'degrees'
     deliveries++;
     ^~~~~~~~~~
     degrees
exit status 1
expected ',' or ';' before 'const'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Source: Windows Questions C++

LEAVE A COMMENT