I have in my source code:
// foo.cpp
struct foo
{
foo() {}
#ifdef I_WANT_THIS_FEATURE
void bar() {}
#endif
};
In my Makefile I have
foo.o: foo.cpp
g++ -c -DI_WANT_THIS_FEATURE foo.cpp -o foo.o
This compiles fine from the command line as well as with the external builder that I have created in Eclipse (which basically defines a few environment variables and calls make
) and I can call foo::bar()
.
However, in the Eclipse CDT source code editor, the part where I define foo::bar()
has a grey background (suggesting that foo::bar()
would not be included in the build) and code completion on objects of type foo
does not suggest bar()
as a method that can be called.
How can I define the I_WANT_THIS_FEATURE
macro in an Eclipse CDT makefile project with custom makefile so that it is known to the source code editor and the code completion?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…