Search code examples
c-preprocessoreclipse-cdtpreprocessor

How can I include an user preprocessor in Eclipse CDT?


I would like to include in my Eclipse CDT project the following prepocessor directive: -D__SHRT_BIT=16 which I have seen that is used in the compiler call, but it is missing in Eclipse,as shown below. enter image description here

I have tried to use the option C/C++ General >> Preprocessor Include Path >>CDT User Settings Entries to set it (as shown below). enter image description here

However, it seems not to be working. Does anyone know why this approach is not valid or what I am missing?

Thanks in advance!


Solution

  • I solved my issue, it was something simple, I was defining the value wrongly for the Macro. I was inserting an extra equal following those in the .h file, whereas I should I have set only one

    For example

    • Wrong => Name:__SHORT_BIT , Value:=16 => Produces: __SHORT_BIT==16
    • Right => Name:__SHORT_BIT , Value:16 => Produces: __SHORT_BIT=16