Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

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

  1. #1
    Junior Member
    Join Date
    Apr 2014

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


    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):

    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.
    Attached Files Attached Files

  2. #2
    Junior Member
    Join Date
    Apr 2014
    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....
    #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[];
    ...the test file now compiles correctly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts