Page 1 of 1
Pre Processor directives
Posted: Fri Feb 06, 2009 12:02 pm
by seulater
i am having a hard time finding out how eclipse understands pre processor directives.
I.E.
if i have "#include...." its ok, but if i were to type say "#hello" i would get a orangish colored "?" by it saying "invalid preprocessor directive"
do any of you Eclipse gurus know if this is somthing embedded into eclipse ?
i want to add my own statements into the file but dont want to have eclipse flag me in error.
such as #verison 2.3.
Re: Pre Processor directives
Posted: Fri Feb 06, 2009 12:30 pm
by lgitlitz
Any C/C++ code will require a valid pre-processor statement after a '#' symbol. Even at command line your code will fail with "#verison 2.3". You need to either use comments or a preprocessor define:
// verison 2.3
or
#define Version 2.3
If you define version to be 2.3, then anywhere in your code with the word version will be replaced with 2.3 before the file is compiled. It is better to use a more unique name for a #define constant.
Re: Pre Processor directives
Posted: Fri Feb 06, 2009 12:38 pm
by seulater
Maybe i should explain what i want to do, so i dont look like a total nut job.
lets say there was a basic compiler that would allow NB products to run basic. so now the whole environment would be based on basic instead of C/C++. Furthermore, lets say that the new basic compiler has some options in it such as when it locates the text "#version xx.xx" in the *.bas file it will do something with that information.
I come to love the Eclipse environment, but am now wondering if one could use it for their own implementation like i mentioned above. I guess i am looking at it as a glorified editor that i can use it as my project manager and then call the basic compiler via command line.
Yet not flag me with warning and errors that really are not.
Re: Pre Processor directives
Posted: Fri Feb 06, 2009 1:58 pm
by hendrixj
That's a matter of "perspective" in eclipse. There are Java perspectives, c/c++, html, xml,...
Netburner provides us with a customized perspective that works well with the Netburner boards. If you google around, byou might find a BASIC perspective. You're always free to write one...