Compilation Error

I’m very new with qtr array sensors. But I cant compile this code to test the sensor
I get the following error message in the line ’ QTRsensors qtr;’ – " Compilation error: ‘QTRSensors::QTRSensors()’ is protected within this context"

Whats wrong here guys

The full error message :

C:\Users\LENOVO\AppData\Local\Temp.arduinoIDE-unsaved20221124-4784-1nbmxlg.a088\sketch_dec24c\sketch_dec24c.ino:16:12: error: ‘QTRSensors::QTRSensors()’ is protected within this context
QTRSensors qtr;
^~~
In file included from C:\Users\LENOVO\AppData\Local\Temp.arduinoIDE-unsaved20221124-4784-1nbmxlg.a088\sketch_dec24c\sketch_dec24c.ino:1:0:
C:\Users\LENOVO\OneDrive\Documents\Arduino\libraries\QTRSensors/QTRSensors.h:133:5: note: declared protected here
QTRSensors()
^~~~~~~~~~
C:\Users\LENOVO\AppData\Local\Temp.arduinoIDE-unsaved20221124-4784-1nbmxlg.a088\sketch_dec24c\sketch_dec24c.ino:16:12: error: cannot declare variable ‘qtr’ to be of abstract type ‘QTRSensors’
QTRSensors qtr;
^~~
In file included from C:\Users\LENOVO\AppData\Local\Temp.arduinoIDE-unsaved20221124-4784-1nbmxlg.a088\sketch_dec24c\sketch_dec24c.ino:1:0:
C:\Users\LENOVO\OneDrive\Documents\Arduino\libraries\QTRSensors/QTRSensors.h:48:7: note: because the following virtual functions are pure within ‘QTRSensors’:
class QTRSensors
^~~~~~~~~~
C:\Users\LENOVO\OneDrive\Documents\Arduino\libraries\QTRSensors/QTRSensors.h:148:18: note: virtual void QTRSensors::readPrivate(unsigned int*)
virtual void readPrivate(unsigned int *sensor_values) = 0;
^~~~~~~~~~~
C:\Users\LENOVO\AppData\Local\Temp.arduinoIDE-unsaved20221124-4784-1nbmxlg.a088\sketch_dec24c\sketch_dec24c.ino: In function ‘void setup()’:
C:\Users\LENOVO\AppData\Local\Temp.arduinoIDE-unsaved20221124-4784-1nbmxlg.a088\sketch_dec24c\sketch_dec24c.ino:24:7: error: ‘class QTRSensors’ has no member named ‘setTypeRC’
qtr.setTypeRC();
^~~~~~~~~
C:\Users\LENOVO\AppData\Local\Temp.arduinoIDE-unsaved20221124-4784-1nbmxlg.a088\sketch_dec24c\sketch_dec24c.ino:25:7: error: ‘class QTRSensors’ has no member named ‘setSensorPins’; did you mean ‘QTRSensors’?
qtr.setSensorPins((const uint8_t){3, 4, 5, 6, 7, 8, 9, 10}, SensorCount);
^~~~~~~~~~~~~
QTRSensors
C:\Users\LENOVO\AppData\Local\Temp.arduinoIDE-unsaved20221124-4784-1nbmxlg.a088\sketch_dec24c\sketch_dec24c.ino:26:7: error: ‘class QTRSensors’ has no member named ‘setEmitterPin’; did you mean ‘_emitterPin’?
qtr.setEmitterPin(2);
^~~~~~~~~~~~~
_emitterPin
Multiple libraries were found for “QTRSensors.h”
Used: C:\Users\LENOVO\OneDrive\Documents\Arduino\libraries\QTRSensors
Not used: C:\Users\LENOVO\OneDrive\Documents\Arduino\libraries\qtr-sensors-arduino-master
exit status 1

Compilation error: ‘QTRSensors::QTRSensors()’ is protected within this context

Hello.

I think the key line from your error report is where it says “Multiple libraries were found for “QTRSensors.h””. The lines below that give the locations. Can you delete the extra copy of the QTRSensors library?

If you continue having trouble after that, I suggest you try starting fresh by removing all of the QTRSensors library files and reinstalling the library by following the instructions on the Arduino library for the Pololu QTR Reflectance Sensors GitHub page.

- Patrick