need help in eclipse to set #define

Discussion in 'Programmer's Corner' started by ep.hobbyiest, Apr 17, 2016.

  1. ep.hobbyiest

    Thread Starter Member

    Aug 26, 2014
    91
    0
    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.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,144
    1,791
    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.
     
  3. ep.hobbyiest

    Thread Starter Member

    Aug 26, 2014
    91
    0
    Thank you very much.
    But in my eclipse this option is not available. here is the screenshot

    [​IMG]
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,144
    1,791
    How about Build Variables?
    You may have to hunt around to find it.
     
  5. ep.hobbyiest

    Thread Starter Member

    Aug 26, 2014
    91
    0
    i m not sure,
    i m new to eclipse ide.
    can u plz help me with this.
     
  6. Papabravo

    Expert

    Feb 24, 2006
    10,144
    1,791
    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.
     
Loading...