Visual Studio C++ does not update new code after building

12,132

Solution 1

The problem resided in the fact that I copied the code from the original project into a brand new project saved elsewhere. When I tried to build the project in the new location it would always build it in the old location (Strange since I copied code directly into brand new files).

When I tried to run the files it would look for the built code in the new location. Therefore it would always get out of date code.

Problem can be fixed by putting the new code back in the old location!

Thanks everyone

Solution 2

I had this problem occur also, using WinForms. I was adding message boxes to test code and nothing was happening, only the pre-existing message boxes worked. I'm not sure 'exactly' how I fixed it, but after clicking "Build Solution", "Rebuild Solution", "Clean Solution" and "Build (program name)" all under the 'Build' menu the problem went away. Unlike the previous problems I had not copied+pasted any code between solutions.

Solution 3

I've started running into an identical problem and I think it all started when I re-created the project under a new name. That is, I had to copy everything. Problem is I don't know what DIDN'T get fully copied and is now responsible for requiring a rebuild to get my code changes. Checked the solution and project files in a text editor and no signs of the old folder structure.

Share:
12,132

Related videos on Youtube

Fabio
Author by

Fabio

Updated on July 10, 2022

Comments

  • Fabio
    Fabio almost 2 years

    Before anything, I will first say that I've been looking everywhere for a solution to this problem for an hour now. There are many identical problems out there but none of the solutions help me.

    I'm trying to debug a small project. When I started working on the project, I could place break points wherever I wanted and I would hit them. But for some reason, now when I place breakpoints outside of the main program (in a class definition, for example), the breakpoints hollow out while the code is running and I get a message saying the source code is different from the original version.

    This led me to believe it was running a previous build, so I made an obvious change by having the code output some random letters "dajfhdjhfds";

    I hit F7 as usual. Got a message saying Build: 1 succeeded. Hit F5, the program runs but does not display the random letters.

    I clean my solution, then build and the changes show. I 'rebuild' the solution, and the changes show. The breakpoints also work.

    But then if I make further changes, the breakpoints stop working and the changes don't appear in the program. Visual Studio is always running old code. I don't want to have to clean my solution every time I want to debug new code.

    I've reset my settings, I checked off "build" in the configuration manager, I even started a whole new project and copied my code into new files. Same issue.

    • kovarex
      kovarex almost 11 years
      I'm experiencing small bugs like this all the time. I'm just 50% sure that it will work unless I rebuild the project.