I am using 1.6.4 IDE with a 800 line sketch when it all went horribly wrong with compiler messages spewing out from what was good code. I cut the code down to what you see below and it this still goes wrong. Am I losing my mind...
This is the basic code
ifdef _X_
unsigned char x[2];
endif
unsigned char b()
{
return 0;
}
unsigned char a()
{
return b();
}
void loop(){}
void setup(){}
When the top three lines say
#ifdef _X_
unsigned char x[2];
#endif
The IDE says
does not compile and the IDE messages are:
definetest.ino: In function 'unsigned char a()':
definetest:27: error: 'b' was not declared in this scope
'b' was not declared in this scope
Where as
#ifdef _X_
//unsigned char x[2];
#endif
compiles
And so does
//#ifdef _X_
unsigned char x[2];
//#endif
Changing the order of the functions so b is in the code before a gives
C:\Users\Alan\AppData\Local\Temp\build3893539535880651798.tmp/core.a(main.cpp.o): In function main': D:\Arduino\_Tools\Arduino\arduino-1.6.4\hardware\arduino\avr\cores\arduino/main.cpp:40: undefined reference to setup'
D:\Arduino_Tools\Arduino\arduino-1.6.4\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to `loop'
collect2.exe: error: ld returned 1 exit status
Error compiling.
I am at a loss ![]()