I realise that Arduino doesn't really support build flags in libraries so I just made a header file with the defines and included that in every file in the library.
The build completes but the hardware will not run. It just locks up with a USB warning light flashing 9 times. ( a teensy error message warning USB connection is lost )
I checked the compile flags in platform IO and arduino in boards.txt and they appear to be the same.
ultimately arduino and platform.io both compile the code using GCC so I am not sure where to go next.
any ideas / things I can try would be much appreciated. the build defines are just telling the library to compile code in a certain way which is working as expected in platform.io
I'll ask this question on the teensy forum to as maybe its a hardware issue as the USB port disappears after upload. but it could it also be that arduino compiles code in a different way ?
the only change is the inclusion of this header in every file of that library.
here is the project including the arduino main file OPUS_TX.ino that compiles / upload on the teensy 4.1 but then crashes the usb connection with 9 pulses of the red LED by the usb port
global_lib_defines.h has this code , which is included in every file in the project
in case anyone ever reads this , I discovered there is possibly something broken in the latest teensyduino libs and/or newest release of arduino IDE. I just went back a few versions of both and everything builds and runs fine.