As Juraj rightly points out, you have a typo, which should give you the following compile time error:
In file included from sketch/Sensor.cpp:1:0:
Sensor.h:17: error: 'pivate' does not name a type
pivate:
^
Here is the correct code for Sensor.h
#ifndef Sensor_h
#define Sensor_h
#include <EEPROM.h>
#include "IMU/L3G.h"
#define CUTOFF_FREQ 30
#define FREQ 400
class Sensor {
public:
Sensor();
~Sensor();
void Init(void);
private:
L3G gyro;
};
#endif
Using Arduino IDE 1.8.5 with Teensyduino 1.42 with:
However, once the typo has been corrected, as above, then I too can reproduce your problem (sort of), with these link errors:
/var/folders/kp/xv3y9k114yq2_64pf8zwh76h0000gp/T/arduino_build_136680/sketch/Sensor.cpp.o: In function `Sensor::Sensor()':
/var/folders/kp/xv3y9k114yq2_64pf8zwh76h0000gp/T/arduino_build_136680/sketch/Sensor.cpp:3: undefined reference to `L3G::L3G()'
/var/folders/kp/xv3y9k114yq2_64pf8zwh76h0000gp/T/arduino_build_136680/sketch/Sensor.cpp.o: In function `Sensor::Init()':
/var/folders/kp/xv3y9k114yq2_64pf8zwh76h0000gp/T/arduino_build_136680/sketch/Sensor.cpp:14: undefined reference to `L3G::init(L3G::deviceType, L3G::sa0State)'
/var/folders/kp/xv3y9k114yq2_64pf8zwh76h0000gp/T/arduino_build_136680/sketch/Sensor.cpp:19: undefined reference to `L3G::enableDefault()'
/var/folders/kp/xv3y9k114yq2_64pf8zwh76h0000gp/T/arduino_build_136680/core/core.a(main.cpp.o): In function `main':
/Volumes/Home/Users/user/Local_Apps/Arduino/Arduino1.8.5-Teensy.app/Contents/Java/hardware/teensy/avr/cores/teensy3/main.cpp:53: undefined reference to `loop'
collect2: error: ld returned 1 exit status
Multiple libraries were found for "Servo.h"
Used: /Volumes/Home/Users/user/Local_Apps/Arduino/Arduino1.8.5-Teensy.app/Contents/Java/hardware/teensy/avr/libraries/Servo
Not used: /Volumes/Home/Users/user/Local_Apps/Arduino/Arduino1.8.5-Teensy.app/Contents/Java/libraries/Servo
Error compiling for board Teensy 3.5.
You are probably getting this error, because you have placed the files L3G.cpp
and L3G.h
in a folder called IMU
in the same folder as your .ino
file. This causes the undefined error, as, while the IDE sees the declaration in the L3G.h
file, the IDE can not find the definition in the L3G.cpp
file.
This is easy to resolve.
If you download the l3g-arduino-master.zip
file from https://github.com/pololu/l3g-arduino, and from within the Arduino IDE you then add the zipped up L3G library to the Arduino library, using Sketch ► Include Library ► Add. ZIP Library...
and then change the line
#include "IMU/L3G.h"
to
#include <L3G.h>
Then it should compile and link without a problem
pivate
? typo?i2c_t3
is for teensy devices