As far as I can tell from the picture you share that you don't have an external power supply connect to the shield to drive the "12 DC motors".
Read https://learn.adafruit.com/adafruit-motor-shield/power-requirements for better understanding on how to power the motors.
Adafruit has a V1 and a V2 motor shield. They have different libraries too. AFMotor.h is for the V1 shield. From the error, I can tell you installed V2 lib. For that you need to include:
The SmartInventor library is to be used with the Rokit Smart board. That board is based around the ATMega32.
The Arduino Mega is not a Rokit Smart board, so the library will not work, since the Arduino Mega us based around the ATMega2560. The two chips are different, and have different sets of internal peripherals. So the registers have different names ...
Try different pins than 5 and 6, because those PWM generators share the timer with delay(), which I'd interpret as: You use analogWrite() to set the timer to fire every n microseconds to toggle your PWM signal -- and then you call delay(1000), which sets that same timer to fire in one second to continue the program.
Pins 10 and 11 do use a different timer, ...