Question is, do you just want to know or do you want your sketch to know?
If you just want to know, open up the Arduino IDE, go to the Help menu, and click on the About Arduino menu item.
The current version of Arduino will print in the upper left of the screen and the version of Teensyduino will print on the upper right of the help screen.
If you want your sketch to know, how to do it in your sketch, if you have not already done so, you might want to turn on verbose compiles in the Arduino preferences and look at the command lines generated:
Like:
Code:
"D:\\arduino-1.8.9\\hardware\\teensy/../tools/precompile_helper" "D:\\arduino-1.8.9\\hardware\\teensy\\avr/cores/teensy3" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_323730" "D:\\arduino-1.8.9\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -x c++-header -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m4 -fsingle-precision-constant -D__MK20DX256__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=96000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\arduino-1.8.9\\hardware\\teensy\\avr/cores/teensy3" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_323730/pch/Arduino.h" -o "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_323730/pch/Arduino.h.gch"
"D:\\arduino-1.8.9\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m4 -fsingle-precision-constant -D__MK20DX256__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=96000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_323730/pch" "-ID:\\arduino-1.8.9\\hardware\\teensy\\avr\\cores\\teensy3" "-ID:\\arduino-1.8.9\\hardware\\teensy\\avr\\libraries\\SPI" "-IC:\\Users\\kurte\\Documents\\Arduino\\libraries\\Adafruit_GFX" "-ID:\\arduino-1.8.9\\hardware\\teensy\\avr\\libraries\\Adafruit_RA8875" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_323730\\sketch\\buildtest.ino.cpp" -o "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_323730\\sketch\\buildtest.ino.cpp.o"
You will see in the command above: -DTEENSYDUINO=147 -DARDUINO=10809
So I am running Arduino 1.8.9 and Teensyduino 1.47
So your sketch could check the value of the defined value: TEENSYDUINO
Like: #if TEENSYDUINO > 145