Multiple definition error

I'm getting some multiple definition errors when I compile and I can't figure out what I'm doing wrong.

Here's the errors I'm getting:

LocalLibrary.cpp.o: In function HotTubControl': LocalLibrary.cpp:6: multiple definition of oneWire'
Hot_Tub_Main.cpp.o:(.bss.oneWire+0x0): first defined here
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld: Disabling relaxation: it will not work with multiple definitions
LocalLibrary.cpp.o: In function HotTubControl': LocalLibrary.cpp:6: multiple definition of oneWireBus'
Hot_Tub_Main.cpp.o:(.bss.oneWireBus+0x0): first defined here

The code is located in GitHub:

I had this working, but I put some of the functions into a class in separate .cpp file and now I get these errors.

Well, you will have multiple definitions. First it compiles Hot_Tub_Main.ino and then main2.cpp which has this:

#include "Hot_Tub_Main.ino"

So that's compiling it twice.

Also in LocalLibrary.h you should not be instantiating the objects:

// Initialize OneWire temp sensors
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature oneWireBus(&oneWire);

Since that is included from Hot_Tub_Main.ino and also LocalLibrary.cpp you are now getting two copies.

Put those 2 lines in Hot_Tub_Main.ino (instead) and then in LocalLibrary.cpp have an external reference:

#include "LocalLibrary.h"

extern OneWire oneWire;
extern DallasTemperature oneWireBus;

That fixed it. Thank you!!