User forums > Using Code::Blocks
Build doesn't recompile with macro-define #include
pozzugno:
--- Code: ("main.c") ---#define INC_FILE "test.h"
#include INC_FILE
--- End code ---
If I build the project, change something in test.h and re-build, C::B doesn't recompile.
It thinks all dependecies of main.c are satisfied. It is not able to consider test.h a dependecy for main.c, because it is a macro-replaced include file.
If I write:
--- Code: ---#include "test.h"
--- End code ---
it works.
Consider that I already added test.h file in the project.
Is there a solution to this problem?
oBFusCATed:
Yes, don't use the macro hack :P
The other option is to patch depslib to parse this correctly.
thomas:
Patching depslib may be much harder than it sounds, though. At least, in a portable, compiler-independent way.
It is not defined by the C standard how string concatenation or generally evaluation of macros within <> is implemented.
So, at best, one would be able to implement single-macro-expanding-to-single-string-literal substitution.
pozzugno:
Ok, it seems C::B is not able to automatically find include dependecies when the file included is a macro.
Is there the possibility to add this dependency manually? Can I say to C::B that main.c depends from the content of test.h too?
MortenMacFly:
--- Quote from: pozzugno on August 07, 2012, 03:36:33 pm ---Is there the possibility to add this dependency manually? Can I say to C::B that main.c depends from the content of test.h too?
--- End quote ---
Using scripting as a pre-build step, yes.
Navigation
[0] Message Index
[#] Next page
Go to full version