Recently I wiped my pc and reinstalled visual studio community 2022. Before re-installation, whenever I made some changes in my projects, I would press F5 to enter debug and it would build all files before entering debug mode.
To make it clear, I can manually build the files every time via pressing ctrl+F7, but it is just a work around.
Now, after making changes and pressing F5 it ignores those changes and runs the last build.
I went over the settings and made sure everything matches with another install I have on a second machine.
I found this post the source file is different from when the module was built and went over all suggested solutions - nothing helped.
I tried making a new project with the thought that maybe the project configuration was at fault... no results.
If you want to re-create this behavior, create a new C++ project and 2 files in it (main.cpp, module.cpp). Here's the code that I used (if you think the code it self causes the issue, please note it):
main.cpp
#include <iostream>
using namespace std;
#include "module.cpp"
int main()
{
handler h;
h.func1();
return 0;
}
module.cpp
#include <iostream>
using namespace std;
class handler
{
public:
void func1()
{
cout << "idk" << endl; // change this line
}
};
Try debugging this setup, for the first time it will build all files since they're new. Afterwards change the marked line, and debug again (without manually building).
Placing a breakpoint in main.cpp and following into func1() will either work smoothly or result in the behavior I described.
Here are screenshots if anyone needs them. open file popup source not found tab