I'm having a project which compiles perfectly with gcc, but fails to compile under Greenhills Integrity environment.
The problem boils down to this three files:
MyVector.cpp // contains function testVector
MyVector.hpp // contains template vector<>
SomeFile.cpp
MyVector.hpp contains template-class for a vector, and MyVector.cpp contains a testing function unrelated to MyVector.hpp's templates.
Now, when I'm using MyVector.hpp's vector templates in SomeFile.cpp, somehow, the function testVector gets injected into SomeFile.cpp. When I cease to use vector in SomeFile.cpp (I'm still #include'ing it of course, I'm just not instantiate the template there) it works perfectly.
Moreover when I injected a warning into function testVector, the compiler showed the warning when I compiled SomeFile.cpp!
Moreover, the build system recompiles SomeFile.cpp when I'm changing things in MyVector.cpp.
When I'm deleting the testVector function from MyVector.cpp and move it to a new NewFile.cpp - it compiles.
No, I didn't include the cpp file by mistake, honest, I double checked it, and greped all my source code.
I have no idea what's going on. I'll be glad for any clue.