I located a set of source code for the old text based star trek game. I was thinking I could possibly port it over to run using the serial monitor. Problem is.. All this stuff is written in straight c and I can't get it to accept my glue code.
To start off I wrote two files.
gloabals.h
#ifndef globals_h
#define globals_h
#include "Arduino.h"
extern "C" void randomize(void);
extern "C" int getch(void);
//extern "C" int max(int a, int b);
//extern "C" int min(int a, int b);
#endif
And gloabls.cpp
#include "globals.h"
#include "Arduino.h"
void randomize(void) {
//srand((int)time(NULL));
}
int getch(void) {
while(!Serial.available());
return (int)Serial.read();
}
And the compiler kicks out this..
globals.h:7: error: expected identifier or '(' before string constant
extern "C" void randomize(void);
^
globals.h:9: error: expected identifier or '(' before string constant
extern "C" int getch(void);
Along with lots of other things, but this is the start and I need to at least get this first function to work.
Anyone have experience in soething like this? 'Cause I don't have a lot in this area.
Thanks!
-jim lee