Simple Arduino Program Fails To Build [solved]

This simple program for my Arduino Nano builds successfully in Arduino IDE, but fails in Atom/Pio.

#include <Arduino.h>
#include <Wire.h>

#define SERIAL_BAUD 9600

void setup() {
	Wire.begin();
	Serial.begin(SERIAL_BAUD);
}

void loop() {
	Wire.requestFrom(8, 1);

	while (Wire.available()) {
		int c = Wire.read();
		Serial.println(c);
	}

	delay(500);
}

Here is the error log pio generates.

Here is my platformio.ini.

Any ideas what I’m doing wrong?

EDIT: My apologies, I just found out the reason, I didn’t use the .ino extension, but .c, I was assuming it’s .c because the language looks like C.

1 Like

You can also use plain c++. Just add a “main.cpp” to source directory and use your code - it should work, at least it does for me.

Thanks, I actually ended up doing that (had to do some conversion for some .ino files though).