PlatformIO Community

*.c source file doesn't compile


I write a program for Teensy 2.0 in ANSI C, but I can only compile it if the file extension is *.cpp or .ino. Having in mind that pure C is valid C++ syntax why I get compilation errors for almost every single line of code?

ini file:

platform = teensy
framework = arduino
board = teensy20
build_flags = -D USB_MIDI

Am I missing something in the configuration of the project? By the way I have included the arduino library header #include <Arduino.h> on top of the program.


Because Arduino is C++ project. You need to implement setup/loop functions. See

If you want to use pure C, then comment framework = arduino line. See native example for AVR