Why error with extern "C" {...?

This error has just started:

In file included from src/flash.h:1:0,
from src/io.c:4:
C:/Users/User/.platformio/packages/framework-arduinoespressif32/libraries/Ticker/src/Ticker.h:28:8: error: expected identifier or ‘(’ before string constant
extern “C” {
#include “timer.h”
}

I can’t see any reason for it.

You can’t use a C++ header file in a .c file. Arduino is a C++ framework, you should be using src/io.cpp

Or how is your io.c file going to understand the timer class and templates?

If you want the low level timers, just do

Since C++ is a <cough> superset </cough> of C, one possible way out is to rename your src/io.c file to src/io.cpp. It will depend greatly on how that code is written whether this can work (perhaps with minor adjustments). And if it’s a larger project then many more files may have to be changed in the same way.

1 Like

duh!!!

I copied them over from a previous project and for got about that, Thankyou!!

1 Like