I have created a new C++ project on a separate computer to properly demonstrate this issue; These are the project files :
Main.cpp
#include "Test.cpp";
int main()
{
Test test;
cout << test.getColor();
return 0;
}
Test.cpp
#include <iostream>
using namespace std;
class Test
{
private:
string color;
public:
Test()
{
color = "blue";
}
string getColor()
{
return color;
}
};
Whenever I change this line to another value (ex: "red") :
color = "blue";
And then run the project, it says it builds and succeeds at building the changes in Test.cpp . When the console opens and displays the value, it still displays the old value of the variable, being in this example "blue". Only when I manually click "Build > Rebuild Solution" does the program do what I expect and print "red". What is going on here
I've tried updating Visual Studio, creating a new project, and looked all over for an answer to this question without any success.