Errors in installing the WIFI driver

I have the Tenda W311MI Wireless Nano USB Adapter. On Windows it automatically installs and works. On Ubuntu there's no wifi networks available. I downloaded the drivers from the Tenda website https://down.tendacn.com/uploadfile/201401/driver/RT5572_LinuxSTA_2.6.1.3_20121022.rar. I don't know C nor am I skilled at the CLI. I found this guide to install the driver https://titanwolf.org/Network/Articles/Article?AID=247af549-250e-4ba1-8098-e3a98133fef8. First I got one error: the solution was to rename the parent folders to simple names. Second I got another error: the solution was to replace all "SUBDIRS=" to "M=". I did the steps in the guide and at last I am at this error on running sudo make on the root of the driver folder:

make -C tools
make[1]: Entering directory '/home/hammad/Downloads/v3/dpo/tools'
gcc -g bin2h.c -o bin2h
make[1]: Leaving directory '/home/hammad/Downloads/v3/dpo/tools'
/home/hammad/Downloads/v3/dpo/tools/bin2h
cp -f os/linux/Makefile.6 /home/hammad/Downloads/v3/dpo/os/linux/Makefile
make -C /lib/modules/5.11.0-44-generic/build M=/home/hammad/Downloads/v3/dpo/os/linux modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-44-generic'
  CC [M]  /home/hammad/Downloads/v3/dpo/os/linux/../../sta/sync.o
/home/hammad/Downloads/v3/dpo/os/linux/../../sta/sync.c: In function ‘PeerBeacon’:
/home/hammad/Downloads/v3/dpo/os/linux/../../sta/sync.c:2180:12: error: passing argument 8 of ‘StaAddMacTableEntry’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 2180 |            ie_list,
      |            ^~~~~~~
      |            |
      |            BCN_IE_LIST * {aka struct _bcn_ie_list *}
In file included from /home/hammad/Downloads/v3/dpo/include/rt_config.h:59,
                 from /home/hammad/Downloads/v3/dpo/os/linux/../../sta/sync.c:28:
/home/hammad/Downloads/v3/dpo/include/rtmp.h:7900:15: note: expected ‘IE_LISTS *’ {aka ‘struct _IE_lists *’} but argument is of type ‘BCN_IE_LIST *’ {aka ‘struct _bcn_ie_list *’}
 7900 |  IN IE_LISTS *ie_list,
      |     ~~~~~~~~~~^~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:288: /home/hammad/Downloads/v3/dpo/os/linux/../../sta/sync.o] Error 1
make[1]: *** [Makefile:1849: /home/hammad/Downloads/v3/dpo/os/linux] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-44-generic'
make: *** [Makefile:395: LINUX] Error 2

Someone answered another post with a similar error with the solution to install gcc-4.8. I couldn't install it. I downloaded the zipped file. Extracted it. Followed a guide to build it but the final step resulted in errors.

I also tried applying this solution: installing ndiswrapper and ndisgtk but couldn't follow the last few steps.

Thank you for reading.

EDIT

$ lsusb
Bus 002 Device 010: ID 0bb4:0ffe HTC (High Tech Computer Corp.) Desire HD (modem mode)
Bus 002 Device 008: ID 0bda:b711 Realtek Semiconductor Corp. RTL8188GU 802.11n WLAN Adapter (After Modeswitch)
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 002: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Solution 1:

To install the correct drivers, run the following commands in a terminal (make sure to have an active internet connection while running the commands):

sudo apt-get install build-essential git dkms linux-headers-$(uname -r)
git clone https://github.com/McMCCRU/rtl8188gu.git
cd rtl8188gu
make
sudo make install
sudo apt install --reinstall linux-firmware 
sudo reboot

That's it!

Take a look at https://github.com/McMCCRU/rtl8188gu