[Error] Compile error using Many-Axis joystick lib and test file

Status
Not open for further replies.

zelfor

Member
Hi!

I'm using a Teensy 3.1 with the latest Arduino and Teensyduino on Linux.
The 3.1 is set to 96MHz optimized and USB Type: Serial + Keyboard + Mouse + Joystick.

I'm trying to use the extreme joystick lib located on the prjc forums here, provided by Mr. Stoffregen (attached to post too).
The library files are extracted into ....arduino-1.6.4/hardware/teensy/avr/cores/teensy3/ and replace the included files .
Loading the test sketch, "ExtremeJoystickTest.ino", I'm receiving the following compilation error(s):

Code:
In file included from /home/zelfor/Documents/arduino-1.6.4/hardware/teensy/avr/cores/teensy3/usb_inst.cpp:32:0:
/home/zelfor/Documents/arduino-1.6.4/hardware/teensy/avr/cores/teensy3/usb_desc.h:304:3: error: conflicting declaration 'typedef struct usb_descriptor_list_t usb_descriptor_list_t'
} usb_descriptor_list_t;
^
In file included from /home/zelfor/Documents/arduino-1.6.4/hardware/teensy/avr/cores/teensy3/usb_serial.h:34:0,
from /home/zelfor/Documents/arduino-1.6.4/hardware/teensy/avr/cores/teensy3/WProgram.h:24,
from /home/zelfor/Documents/arduino-1.6.4/hardware/teensy/avr/cores/teensy3/usb_inst.cpp:31:
/home/zelfor/Documents/arduino-1.6.4/hardware/teensy/avr/cores/teensy3/usb_desc.h:304:3: error: 'usb_descriptor_list_t' has a previous declaration as 'typedef struct usb_descriptor_list_t usb_descriptor_list_t'
} usb_descriptor_list_t;
^
Error compiling.

I've got arduino under src control, so reverting back isn't an issue, but I was really looking forward to the improved joystick library.
I'm hesitant to take a whack at fixing it myself without understanding fully the ramifications of any changes I might make.
 

Attachments

  • extreme_joystick_test3.zip
    13 KB · Views: 86
  • ExtremeJoystickTest.ino
    3.2 KB · Views: 94
Ok, so usb_serial.h and usb_inst.cpp both include usb_desc.h. I suspected their might be some multi-including issue going on, so I wrapped the following code in usb_desc.h from the extreme joystick lib with a #ifndef....
Code:
#ifndef _usb_dec_t
#define _usb_dec_t
extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];

typedef struct {
	uint16_t	wValue;
	uint16_t	wIndex;
	const uint8_t	*addr;
	uint16_t	length;
} usb_descriptor_list_t;

extern const usb_descriptor_list_t usb_descriptor_list[];
#endif

...the test file now compiles correctly
 
Status
Not open for further replies.
Back
Top