This question is about a C ++ project managed by CDT 8.1.2 inside Eclipse 4.2.2 (Juno). The following code fragment will be compiled, but it will appear as having errors inside Eclipse.
I have a file called foo.h that says:
int a = 42;
This file is included in another foo.cpp file:
#include <cstdio> int main() { #include "foo.h" printf("%d", a); return 0; }
How can I fix the "A" character cannot be resolved? In my understanding, the #include statement inside the main () function should trigger a simple copy-paste action in the preprocessor. CDT seems to index the file correctly, because I can use CTRL- click on the name of the file "foo.h" which then opens the file in the IDE. Interestingly, if I move the #include "foo.h" statement just below the #include <cstdio> , it works as expected. Is there Is there any option inside CDT to do preprocessing before character resolution?
Side note. I know this code design was frowned upon, however I need to import the code written by someone else and require the content to be configured correctly in order to be productive.
source share