need help in eclipse to set #define

Thread Starter

ep.hobbyiest

Joined Aug 26, 2014
143
Hello i m using eclipse IDE.
I am facing some problem. For my project i m using many source files. But at the beginning all of source file i m checking #ifdef processor.

So enable that source file and access the function i have set #define processor. So, my question is

Is it possible in eclipse to set #define processor in environment variable?
So, it will be set to all files.
 

Papabravo

Joined Feb 24, 2006
12,695
Don't know about eclipse, but it was an important feature in CodeVision. We might not have been able to specify a macro substitution, giving a list of defined variables was all. If the feature exists there should be a dialog box that lets you enter a list of "defined" variables.

EDIT: I found this on the Eclipse Community Forum

This is absolutely possible. I use it all the time. When you say you are
setting the properties, where exactly are you modifying?

You should be at Project->Properties and select C/C++ Build->Settings.
Find under Tool settings, the preprocessor -D options. Add your
FOO_DEFINED here. This will add -DFOO_DEFINED to your build script.

Or you could just add #define FOO_DEFINED to some include file and include
that file in main.cpp when you need it.
 

Papabravo

Joined Feb 24, 2006
12,695
i m not sure,
i m new to eclipse ide.
can u plz help me with this.
I haven't used Eclipse for about six years, but I remember it being in a dialog box where you could #define symbols. You could NOT do macro substitution, you could only use #ifdef and #ifndef on them. I'm sorry I can't be more help. Just start going through the dialog boxes one by one, or go to the forum for Eclipse users.
 
Top