The most frequent reason comes from embedXcode using true C++, contrary to the Arduino IDE that performs under-the-hood tasks.


Let's consider the following basic sketch:



Arduino compiles this sketch but embedXcode fails with the message


In file included from main.cpp:18:

embed1.ino: In function 'void loop()':

/Users/ReiVilo/Documents/Projets/Xcode/embed1/embed1/embed1.ino:70: 'blink' was not declared in this scope


Because embedXcode relies on true C++, a function needs to be declared before it is called. Among other automatic under-the-hood tasks, the Arduino IDE adds prototypes.


Two easy solutions, both of them fully compatible with the standard Arduino IDEs: 

  • Place blink() before setup()


  • Declare a prototype for blink()