'OneWire' does not have a type

I really need some help on this one. I have connected up a dallas sensor and loaded the get address code to find it’s address.

But the code does not compile, it errors on this line:

OneWire ds(3); // Connect your 1-wire device to pin 3

I have tried everything, I have the latest of both libraries, both are in the folder and I have restarted the IDE but still nothing.

Hi connersz

Please post your full code (using code tags) and the error you get when compiling.

both are in the folder

And please clarify exactly what the path is to the library files you have installed.

All the best


Here is the code:

#include <OneWire.h>

OneWire  ds(3);  // Connect your 1-wire device to pin 3

void setup(void) {

void discoverOneWireDevices(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
  Serial.print("Looking for 1-Wire devices...\n\r");
  while(ds.search(addr)) {
    Serial.print("\n\rFound \'1-Wire\' device with address:\n\r");
    for( i = 0; i < 8; i++) {
      if (addr[i] < 16) {
      Serial.print(addr[i], HEX);
      if (i < 7) {
        Serial.print(", ");
    if ( OneWire::crc8( addr, 7) != addr[7]) {
        Serial.print("CRC is not valid!\n");
  Serial.print("\n\r\n\rThat's it.\r\n");

void loop(void) {
  // nothing to see here

The libraries (TemperatureSensor & OneWire) are in Documents\Arduino\Libraries

The libraries (TemperatureSensor & OneWire) are in Documents\Arduino\Libraries

What is the exact folder and file structure below "Documents\Arduino\Libraries" for the OneWire.h and OneWire.cpp files, in particular? The Arduino IDE is very precise in what it expects :-)

EDIT Could you also confirm what the "sketchbook location" is when you do File - Preferences in the IDE.

And please copy and paste the compiler error message.