Teensyduino 1.53 Compile error on Win7

dkelley01

New member
I am using the Arduino IDE with Teensyduino 1.53 installed on Windows 7 machine and have selected as the board "Teensy 3.2/3.1". I declare some global short x1, y1, x2, y2; and assign y1 a value.
I get the following error(s):

C:\Users\don\Documents\Projects\Instructable Projects\Chess_Robot\Test_Programs\IDETest_Teensy3.1\IDETest_Teensy3.1.ino:1:11: error: 'short int y1' redeclared as different kind of symbol
short x1, y1, x2, y2;
^
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/WProgram.h:36:0,
from C:\Users\don\AppData\Local\Temp\arduino_build_516762\pch\Arduino.h:6:
c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\math.h:539:15: note: previous declaration 'double y1(double)'
extern double y1 _PARAMS((double));

C:\Users\don\Documents\Projects\Instructable Projects\Chess_Robot\Test_Programs\IDETest_Teensy3.1\IDETest_Teensy3.1.ino: In function 'void setup()':
C:\Users\don\Documents\Projects\Instructable Projects\Chess_Robot\Test_Programs\IDETest_Teensy3.1\IDETest_Teensy3.1.ino:5:8: error: assignment of function 'double y1(double)'
y1 = 5;
^
C:\Users\don\Documents\Projects\Instructable Projects\Chess_Robot\Test_Programs\IDETest_Teensy3.1\IDETest_Teensy3.1.ino:5:8: error: cannot convert 'int' to 'double(double)' in assignment

Error compiling for board Teensy 3.2 / 3.1.

The following is the code:
Code:
short x1, y1, x2, y2;

void setup()
{
    y1 = 5;
}

void loop()
{
    while(1);
    
}

Is this something I can fix or is there something in a library that is not properly scoped?
Thanks, don
 
y1 is already defined by the math library (y1 is the name for a Bessel function). Therefore you can not declare a global variable with this name. It is the same as you would like to declare a global variable named sin, or cos, or exp...
 
Use a different name for "y1". That name is already spoken for and declared with a different type.

With verbose compile it shows here as:
Code:
T:\tCode\FORUM\VarConflict\VarConflict.ino:1:11: error: 'short int y1' redeclared as different kind of symbol
 short x1, y1, x2, y2;
           ^
In file included from T:\arduino-1.8.13\hardware\teensy\avr\cores\teensy4/WProgram.h:36:0,
                 from T:\TEMP\arduino_build_VarConflict.ino\pch\Arduino.h:6:
t:\arduino-1.8.13\hardware\tools\arm\arm-none-eabi\include\math.h:539:15: note: previous declaration 'double y1(double)'
 extern double y1 _PARAMS((double));
               ^
T:\tCode\FORUM\VarConflict\VarConflict.ino: In function 'void setup()':
T:\tCode\FORUM\VarConflict\VarConflict.ino:10:8: error: assignment of function 'double y1(double)'
     y1 = 5;
        ^
T:\tCode\FORUM\VarConflict\VarConflict.ino:10:8: error: cannot convert 'int' to 'double(double)' in assignment
 
Thanks for the quick response. I was confused as this is the first time that I have used a Teensy with the Arduino IDE and when I compile the same program for an Arduino Mega, it compiles cleanly. I might have expected to have to include a math library to get that conflict. Well Thanks for the help and explanation of the error.
 
I might have expected to have to include a math library to get that conflict.
The Arduino IDE automatically includes Arduino.h. The error message defragster posted, shows that Arduino.h includes WProgram.h which includes math.h...
 
Back
Top