MRK 1010 WIFI Connection Errors due to Library Issue

I bought this board as it was a genuine Arduino board with Wifi. I cannot get the simple connect to WIFI to work from the getting started. I have tried other sample programs and have run into the same issue. 8266 boards have worked fine.

Here is the errors:

Arduino: 1.8.15 Hourly Build 2021/05/31 10:34 (Mac OS X), Board: "Arduino MKR WiFi 1010"

/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp: In member function 'int WiFiClass::begin(const char*)':
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp:47:21: error: 'WL_MAX_ATTEMPT_CONNECTION' was not declared in this scope
  uint8_t attempts = WL_MAX_ATTEMPT_CONNECTION;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp:47:21: note: suggested alternative: 'WL_DELAY_START_CONNECTION'
  uint8_t attempts = WL_MAX_ATTEMPT_CONNECTION;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
                     WL_DELAY_START_CONNECTION
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp: In member function 'int WiFiClass::begin(const char*, uint8_t, const char*)':
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp:67:21: error: 'WL_MAX_ATTEMPT_CONNECTION' was not declared in this scope
  uint8_t attempts = WL_MAX_ATTEMPT_CONNECTION;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp:67:21: note: suggested alternative: 'WL_DELAY_START_CONNECTION'
  uint8_t attempts = WL_MAX_ATTEMPT_CONNECTION;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
                     WL_DELAY_START_CONNECTION
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp: In member function 'int WiFiClass::begin(const char*, const char*)':
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp:86:21: error: 'WL_MAX_ATTEMPT_CONNECTION' was not declared in this scope
  uint8_t attempts = WL_MAX_ATTEMPT_CONNECTION;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp:86:21: note: suggested alternative: 'WL_DELAY_START_CONNECTION'
  uint8_t attempts = WL_MAX_ATTEMPT_CONNECTION;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
                     WL_DELAY_START_CONNECTION
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp: In member function 'uint8_t WiFiClass::beginAP(const char*, uint8_t)':
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp:111:21: error: 'WL_MAX_ATTEMPT_CONNECTION' was not declared in this scope
  uint8_t attempts = WL_MAX_ATTEMPT_CONNECTION;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp:111:21: note: suggested alternative: 'WL_DELAY_START_CONNECTION'
  uint8_t attempts = WL_MAX_ATTEMPT_CONNECTION;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
                     WL_DELAY_START_CONNECTION
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp: In member function 'uint8_t WiFiClass::beginAP(const char*, const char*, uint8_t)':
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp:136:21: error: 'WL_MAX_ATTEMPT_CONNECTION' was not declared in this scope
  uint8_t attempts = WL_MAX_ATTEMPT_CONNECTION;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src/WiFi 2.cpp:136:21: note: suggested alternative: 'WL_DELAY_START_CONNECTION'
  uint8_t attempts = WL_MAX_ATTEMPT_CONNECTION;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
                     WL_DELAY_START_CONNECTION
exit status 1
Error compiling for board Arduino MKR WiFi 1010.


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

Here is the code:

#include <WiFiNINA.h>

char ssid[] = "mySSID";        // your network SSID (name)
char pass[] = "myPassword";    // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS;     // the Wifi radio's status

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial);

  // attempt to connect to Wifi network:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to network: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }

  // you're connected now, so print out the data:
  Serial.println("You're connected to the network");
  
  Serial.println("----------------------------------------");
  printData();
  Serial.println("----------------------------------------");
}

void loop() {
  // check the network connection once every 10 seconds:
 delay(10000);
 printData();
 Serial.println("----------------------------------------");
}

void printData() {
  Serial.println("Board Information:");
  // print your board's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  Serial.println();
  Serial.println("Network Information:");
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(rssi);

  byte encryption = WiFi.encryptionType();
  Serial.print("Encryption Type:");
  Serial.println(encryption, HEX);
  Serial.println();
}

there should be no WiFi 2.cpp in the WiFiNINA library

It seems to be there. It is a Mac I am using.

(base) george@Mac-Mini-M1 src % pwd
/Users/georgeshafer_1/Documents/Arduino/libraries/WiFiNINA/src
(base) george@Mac-Mini-M1 src % ls -l
total 280
-rw-r--r--@ 1 george staff 7589 30 Nov 1979 WiFi 2.cpp
-rw-r--r--@ 1 george staff 7549 30 Nov 1979 WiFi 2.h
-rw-r--r--@ 1 george staff 9385 16 Nov 11:33 WiFi.cpp
-rw-r--r--@ 1 george staff 8425 16 Nov 11:33 WiFi.h
-rw-r--r--@ 1 george staff 5602 30 Nov 1979 WiFiClient 2.cpp
-rw-r--r--@ 1 george staff 1908 30 Nov 1979 WiFiClient 2.h
-rw-r--r--@ 1 george staff 7496 16 Nov 11:33 WiFiClient.cpp
-rw-r--r--@ 1 george staff 2155 16 Nov 11:33 WiFiClient.h
-rw-r--r--@ 1 george staff 898 30 Nov 1979 WiFiNINA 2.h
-rw-r--r--@ 1 george staff 898 16 Nov 11:33 WiFiNINA.h
-rw-r--r--@ 1 george staff 1195 30 Nov 1979 WiFiSSLClient 2.cpp
-rw-r--r--@ 1 george staff 1146 30 Nov 1979 WiFiSSLClient 2.h
-rw-r--r--@ 1 george staff 1559 16 Nov 11:33 WiFiSSLClient.cpp
-rw-r--r--@ 1 george staff 1368 16 Nov 11:33 WiFiSSLClient.h
-rw-r--r--@ 1 george staff 2309 30 Nov 1979 WiFiServer 2.cpp
-rw-r--r--@ 1 george staff 1367 30 Nov 1979 WiFiServer 2.h
-rw-r--r--@ 1 george staff 2695 16 Nov 11:33 WiFiServer.cpp
-rw-r--r--@ 1 george staff 1388 16 Nov 11:33 WiFiServer.h
-rw-r--r--@ 1 george staff 1102 16 Nov 11:33 WiFiStorage.cpp
-rw-r--r--@ 1 george staff 4594 16 Nov 11:33 WiFiStorage.h
-rw-r--r--@ 1 george staff 4405 30 Nov 1979 WiFiUdp 2.cpp
-rw-r--r--@ 1 george staff 3584 30 Nov 1979 WiFiUdp 2.h
-rw-r--r--@ 1 george staff 4405 16 Nov 11:33 WiFiUdp.cpp
-rw-r--r--@ 1 george staff 3584 16 Nov 11:33 WiFiUdp.h
drwxr-xr-x@ 27 george staff 864 16 Nov 11:40 utility

Looks like it was a library problem. I deleted the WiFiNINA library and reinstalled it and now it works.

Please edit the title. Your question has nothing to do with "connection errors"