Pre Processor directives

Topics for the Eclipse Environment
Post Reply
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Pre Processor directives

Post 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.
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: Pre Processor directives

Post 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.
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Re: Pre Processor directives

Post 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.
hendrixj
Posts: 33
Joined: Thu Oct 23, 2008 11:39 am

Re: Pre Processor directives

Post 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...
Post Reply