"'CapacitiveSensor' does not name a type"

Hello to anyone reading this. I’m new to Arduino, and I keep receiving the message “‘CapacitiveSensor’ does not name a type” when trying to verify the CapacitiveSensorSketch. I would really appreciate it if someone could help me figure out this issue.

The version I downloaded was CapacitiveSensor04.zip. And I believe I downloaded it in the right place (Documents > Arduino > libraries > Arduino_Libraries_Capacitive_Sensor). I will also attach a picture of where the sketch shows up when I go to open it. My version of Arduino is 1.0.5. The orange text with black background at the bottom of the opened sketch reads:

“CapacitiveSensorSketch:12: error: ‘CapacitiveSensor’ does not name a type
CapacitiveSensorSketch:13: error: ‘CapacitiveSensor’ does not name a type
CapacitiveSensorSketch:14: error: ‘CapacitiveSensor’ does not name a type
CapacitiveSensorSketch.pde: In function ‘void setup()’:
CapacitiveSensorSketch:18: error: ‘cs_4_2’ was not declared in this scope
CapacitiveSensorSketch.pde: In function ‘void loop()’:
CapacitiveSensorSketch:25: error: ‘cs_4_2’ was not declared in this scope
CapacitiveSensorSketch:26: error: ‘cs_4_6’ was not declared in this scope
CapacitiveSensorSketch:27: error: ‘cs_4_8’ was not declared in this scope”

Again, I would be incredibly grateful to whoever can help me solve this dilemma. Thank you!

Your library (which you didn't provide a link for BTW) seems to be delivered in two versions, one for the "standard" Arduino (UNO, Mega, Leonardo, etc) and one for the new Due. You must select the correct one and move that directory into your libraries folder (which should be in the sketchbook folder).


I had the same issue beacause I extracted CapacitiveSensor004.zip directly under my librairies folder but IN THE ZIP FILE you have to take the folder under the folder named libraries and place it in your librairies folder (e.g. ...Documents\Arduino\libraries).


I have done everything you are suggesting here, but for some reason I keep getting the same error message any further help would be appreciated