I have been trying to figure out why visual studio has not been recompiling all the compilation units affected by a header file change in my Library project.
Lets say I have the following header file TestA.h:
class TestA
{
public:
int GetNumber() { return 0 };
std::string GetString(); // implemented in TestA.cpp
}
Lets say I then have 3 .cpp files TestA.cpp TestB.cpp TestC.cpp
TestA.cpp Only contains the function implementations for TestA
However both TestB.cpp and TestC.cpp follow something of the sort:
#include "TestA.h"
....
TestA* aObject = new TestA();
int aNumber = aObject->GetNumber();
...
This is where the problem now lays, if I change the function GetNumber in TestA.h to GetNumber1 Visual studio and msbuild command line will only build TestA.cpp and it will succeed in compiling. It will then generate the .lib using the now stale .obj files. If I however rebuild then I get the errors that I do expect. I have tried enabling/disabling Incremental linking, minimal rebuilding, Managed Incremental Build.
I can achieve the desired behavior by deleting the .obj and the .tlog files from my intermediate directory.
Any help is appreciated
Thanks Sumeth