PaulStoffregen / Encoder

Quadrature Encoder Library for Arduino
http://www.pjrc.com/teensy/td_libs_Encoder.html
561 stars 243 forks source link

Compilation warning on no interrupt example #31

Open highvoltspam opened 5 years ago

highvoltspam commented 5 years ago

Description

The no interrupt example throws out a bunch of errors on a new arduino 1.87 installation: Encoder.h:69:7: Warning: type 'struct encoder' voilates one definition rule [-Wodr] Encoder.h:69:7 - a different type is defined in another translation unit. Encoder.h:132:10: the first difference ofr corresponding definitions is field 'interrupts_in_use' etc...

Steps To Reproduce Problem

Installed new Arduino 1.8.7 on win10 machine. Installed Encoder library compiled No interrupt example

PaulStoffregen commented 5 years ago

Which board is selected in Tools > Boards?

highvoltspam commented 5 years ago

Which board is selected in Tools > Boards? The Arduino MEGA 2560

I only see this on the new installation. I didnt used to see this on the previous laptop.

Tolteque commented 3 years ago

Hi, I have the same compilation issues (warnings) when compiling for "Arduino Micro"

define ENCODER_DO_NOT_USE_INTERRUPTS

include

Have you find a solution ? Thx

After short investigation, I think it is due to the include of "Encoder.h" in "Encoder.cpp" without using neither ENCODER_USE_INTERRUPTS nor ENCODER_DO_NOT_USE_INTERRUPTS. So "Encoder.h" assumes that ENCODER_USE_INTERRUPTS is used, and for my part I include "Encoder.h" with ENCODER_DO_NOT_USE_INTERRUPTS !!!