Trouble using OneWire Library

Hello guys,

I’ve been trying several examples to use one DS18D20 temperature sensor, but I get an annoying error with the OneWire library all the time.

Than I tryed some very simple code just to instance the OneWire object, and the same error persists.

The code i’m trying is:

#include <OneWire.h>

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

void setup(void) {
}

void loop(void) {
}

And the message error is always the same:

one_wire_address_finder.cpp.o: In function `__static_initialization_and_destruction_0':
C:\Program Files (x86)\Arduino/one_wire_address_finder.pde:4: undefined reference to `OneWire::OneWire(unsigned char)'

Is there anyone here who can help me?

Thanks!

Is there anyone here who can help me?

Without knowing which version of the IDE you are using? No.

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

Most people would have chosen to use a variable to hold the pin number. Perhaps that is a clue (the wrong variable type is being detected).

I forgot to say that I'm using the Arduino IDE 1.0.5-r2

I've tried setting this pin using variables, constants... But nothing works. Every example with OneWire in the intenet declares the pin as I did, but it simply give the same message every time.

I'm on win8 64 bits, could this have any influence?

I'm on win8 64 bits, could this have any influence?

Could be, because your code compiles fine on Win7 64 bit, using 1.0.5.

What it really looks like, on closer reading, is that the problem is with the linker not being able to find the OneWire object to load stuff from.

What is confusing is this:

C:\Program Files (x86)\Arduino/one_wire_address_finder.pde

If you are using 1.0.5, the extension type is ino, not pde. Sketches need to be in a directory with the same name as the .ino (or .pde) file. This particular file is not.

Create a new sketch, please, and paste that code into it. Show us the exact messages you get when you do that.