forked fromzephyrproject-rtos/gsoc-2022-arduino-core
Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork30
Fix .c file compile that include <Arduino.h>#139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Both GIGA and Portenta H7 have the files pure_analog_pins.h which is included within Arduino.hIf you should by chance have a .c file either in library or sketch that include Arduino.hsuch as simple file:foo.c```#include <Arduino.h>void foo() {}```The build will fail with errors like:```In file included from C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/variant.h:6, from C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\cores\arduino/Arduino.h:133, from C:\Users\kurte\AppData\Local\Temp\.arduinoIDE-unsaved2025512-1916-i38ngk.ik13\sketch_jun12a\foo.c:1:C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h:25:1: error: unknown type name 'class' 25 | class PureAnalogPin { | ^~~~~C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h:25:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 25 | class PureAnalogPin { | ^C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h:40:8: error: unknown type name 'PureAnalogPin' 40 | extern PureAnalogPin A0_PURE; | ^~~~~~~~~~~~~C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h:41:8: error: unknown type name 'PureAnalogPin' 41 | extern PureAnalogPin A1_PURE; | ^~~~~~~~~~~~~C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h:42:8: error: unknown type name 'PureAnalogPin' 42 | extern PureAnalogPin A2_PURE; | ^~~~~~~~~~~~~C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h:43:8: error: unknown type name 'PureAnalogPin' 43 | extern PureAnalogPin A3_PURE; | ^~~~~~~~~~~~~C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h:54:57: error: unknown type name 'PureAnalogPin' 54 | void PURE_ANALOG_AS_DIGITAL_ATTRIBUTE pinMode (PureAnalogPin pin, PinMode mode); | ^~~~~~~~~~~~~C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h:55:57: error: unknown type name 'PureAnalogPin' 55 | PinStatus PURE_ANALOG_AS_DIGITAL_ATTRIBUTE digitalRead (PureAnalogPin pin); | ^~~~~~~~~~~~~C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h:56:57: error: unknown type name 'PureAnalogPin' 56 | void PURE_ANALOG_AS_DIGITAL_ATTRIBUTE digitalWrite(PureAnalogPin pin, PinStatus value); | ^~~~~~~~~~~~~C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h:57:24: error: unknown type name 'PureAnalogPin' 57 | int analogRead (PureAnalogPin pin); | ^~~~~~~~~~~~~C:\Users\kurte\Documents\Arduino\hardware\arduino-git\ArduinoCore-zephyr\variants\arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h:58:57: error: unknown type name 'PureAnalogPin' 58 | void PURE_ANALOG_AS_DIGITAL_ATTRIBUTE analogWrite (PureAnalogPin pin, int value); | ^~~~~~~~~~~~~exit status 1Compilation error: exit status 1Fix is to simply add #ifdef __cplusplus to the header files (along with #endif ...
8490908
intoarduino:arduino 15 checks passed
Uh oh!
There was an error while loading.Please reload this page.
pillo79 pushed a commit that referenced this pull requestAug 1, 2025
Fix .c file compile that include <Arduino.h>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both GIGA and Portenta H7 have the files pure_analog_pins.h which is included within Arduino.h
If you should by chance have a .c file either in library or sketch that include Arduino.h such as simple file:
foo.c
The build will fail with errors like: