possible compiler malfunction

majenko: thats exactly what im after, not what michinyon was saying. pYro: when you say to move my defines into a header file, do you mean constants like #IMAGE_ROWS 45, or just the constants like #DISABLE_CAMERA, or both. and correct me if im wrong, but then the code would look like this: definitions.h

#define DISABLE_CAMERA
//other #defines

then imagetracking.ino would be

...
#include <SPI.h>
#include "definitions.h"
...

The IDE adds '#include "Arduino.h" before the first line of code, pre-processor directives ( #ifndef, #define ) are not considered.
So the IDE takes what it thinks is the first line of code, which is 'gt4ghuitregbuitregbre'

adding a dummy integer declaration above may fix it too, separating into multiple files is another option. Either way, the stuff protected by pre-processor commands cannot be the first thing in the sketch.

did you look at my sketch? i have #include (Arduino.h) (im on my phone. no angle brackets) and the lines that im having trouble with are nowhere near the top

nah, the forums are having a silly moment, I keep getting 503 errors when I try download.

thats why i pastebinned my code (all 5 files).

The arduino IDE preprocessor generates prototypes and some #includes that it puts at the beginning of the program for you. It is not very good at detecting "the beginning of the program", in the presence of C preprocessor directives. I usually give it a hint:

char Arduino_preprocessor_hint;
#include <blah>
#ifdef FOO
 // otherstuff
#endif

As for allocating 8100 bytes of RAM...
Don't forget that any use of serial on a MEGA will cause something like 640 bytes of serial buffers to be allocated (perhaps even if you don't use serial...)

so all i have to do is define a bogus char at the beginning of the file, and the ide will pre-pre-compile correctly? also, the 8100 byte thingy, im not sure thats how i will implement it

adding byte unused; just above #define DISABLE_CAMERA worked. do you think i should file a bug report for this, or does it fall under the known issues on the troubleshooting page?

I think it's covered here: Google Code Archive - Long-term storage for Google Code Project Hosting.
and Google Code Archive - Long-term storage for Google Code Project Hosting.

Though perhaps it's not as well-known as expected. (part of the issue is that the normal Arduino user is not expected to be using conditional compilation)

westfw:
Though perhaps it's not as well-known as expected. (part of the issue is that the normal Arduino user is not expected to be using conditional compilation)

Weeeeelllllllllllllllll............. yeah. but you cant fault me for having impressive code.

Id much rather use emacs (yes im old school. but i code in emacs faster than any editor iv found), but i havent had much success with a custom build process.

fizyplankton:
Id much rather use emacs (yes im old school. but i code in emacs faster than any editor iv found), but i havent had much success with a custom build process.

Emacs?! Bleaugh! You obviously have resources to waste.

VI FTW! (and not VIM, proper VI :stuck_out_tongue: )

Id much rather use emacs

Me too, if I'm doing any serious editing.
Try the "Use external Editor" preference in the Arduino IDE. It actually works impressively well, for such a simple feature. What it does seems twofold: 1) don't allow the IDE to edit the sketch, and 2) re-read the sketch from disk before each "verify" or "upload" action.
So you can go along in emacs, save your file, click the upload button on the IDE, and have it do the right thing.

majenko:
VI FTW! (and not VIM, proper VI :stuck_out_tongue: )

a tad bit off topic, but i have never used vi. i tried to learn, but vim comes up when i type in vi. vim was not just user-unfriendly, it was proactively user-hostile. i cant vouch for plain vi, but if vimproved had me scared for my life in seconds, then viunimproved......

westfw:
Try the "Use external Editor" preference in the Arduino IDE. It actually works impressively well, for such a simple feature. What it does seems twofold: 1) don't allow the IDE to edit the sketch, and 2) re-read the sketch from disk before each "verify" or "upload" action.
So you can go along in emacs, save your file, click the upload button on the IDE, and have it do the right thing.

how would that work if i tried to work on it thru SSH? i could always forward X and start up arduino remotely, but in addition to being a terrible idea, not all of the places i SSH from have graphical capabilities. i frequently ssh from my phone, tablet, laptop, and school computers (which are so bad that SSHing a java gui just makes me shudder). the first three dont have graphics, and then theres the school comps