Does this seem correct and normal?
That’s how I understand it.
The linker is the one who decides what belongs together.
The compiler only sees individual modules (
.cpp files), whether they will be linked or not is irrelevant for it.
That way the compiler doesn’t need to care about the order of compilation.
Otherwise it would first need to analyse the entire project and do some of the linker’s jobs as well.
However, once a module is built and its sources don’t change, there should not be a re-compile (unless you initiate a clean build).
Interesting. Thanks @ScruffR. I really ask because of an issue I have run into when bringing in the
TensorFlowLite library. I see that it compiles it with many warnings but no errors even though I haven’t included any of its files into the main
However, what is odd is I can no longer just create a new
.h file in my
src directory of my main project and
#include it without getting a multiply defined error. I have even boiled this down to just a simple one liner where I am confident I am not redefining something in the library but I now get this error on every compile.
const uint32_t abc = 42;
The compilation of the library (now that i understand is compiled no matter what) appears to break my ability to include other files in my main
Are you guarding your headers against multi-inclusion?
I see there are two or three
.h files in the
TensorFlow library that are not guarded - adding that therein cannot harm.
Just, be aware: When cloud compiling (even with Workbench) any reference to cloud based libraries will take precedence over locally altered libraries.
Yep, I have added the
to my test file and still get the same error. Also, I’m locally compiling not cloud compiling if that makes a difference.
Can you try a project clean
Haha, yep, have done that as well.
I’ll create a repo of this and if you are game to try it out that would be awesome. Otherwise, totally understand.
Well, in moving to create a new project with everything it no longer duplicates. Amazing. After two days of fighting this error it magically goes away. Sorry for the fire drill @ScruffR but maybe the threat of sending the code to you whipped the compiler and linker into shape.