6

I am working in Visual Studio 2010, and I can go through and write code fine, and IntelliSense even works well, but when I go to run the compiler after modifying the code the changes don't always take. this happens in c++ Win32 console applications, c++ Windows applications, and c++ CLR console applications. It has even happened in C# XNA as well.

what I mean is that i will start coding a new program, and be writing code then go to build to check for errors, and then run the program, and it will work fine (if there were no errors). but then if I want to iterate the code to add features I implement (some of which should change output tremendously), and it is as though it was at the first build. also if I insert break points they don't always take either like they are being ignored as well (except for the ones in files that were untouched). though when I go to build at these times the compiler does throw errors correctly (inserted purposefully, and accidentally), and only at those points does it take all changes.

the only workaround that I have found is to go and do a full rebuild after every modification, but this shouldn't be necessary as I am not adding headers, or changing compile order. sometimes it will ignore the modification of a single character being changed in a cout.

summary:

  • compiler ignores changes made since last build
  • compiler ignores break points in modified files
  • have to perform full rebuild to have changes, and breakpoints take.

does anyone have any thoughts on this.

edit: it seems that changing Tools > options > "Projects and Solutions" > "Build and Run" > "on Run, when projects are out of date" to "Prompt to build" does fix the problem. though annoying to be asked every time it is less annoying then having to manually request a rebuild. need to do further iterations to see if this is not just superficial.

edit2: after continuing to iterate through current project it appears that this change does not fix the issue, but only for the main file, and any sub files still need a full rebuild to take modifications even small ones.

gardian06
  • 1,496
  • 3
  • 20
  • 34

2 Answers2

3

If its happening on all projects its probably the first fix mentioned in this answer

Community
  • 1
  • 1
Peter Wishart
  • 11,600
  • 1
  • 26
  • 45
  • 1
    checked those options, and both were in the states that the answer stated. – gardian06 Mar 05 '12 at 01:45
  • 1
    Does the build output look like its building?? Is it set to save on build as well (next to the first fix in that link)? – Peter Wishart Mar 05 '12 at 01:52
  • 1
    switching from always build to prompt to build might have fixed it need to do further iterations of project to fully test theory. would still be less annoying then having to manually rebuild every time, or getting frustrated that changes didn't take. +1 answer. when confirmed accept – gardian06 Mar 05 '12 at 01:57
  • 1
    appears that this is not the answer. as it only fixes the issue as it pertains to the main.cpp, and not other files/class – gardian06 Mar 05 '12 at 03:09
  • Hmm.. are the other files included in the project (i.e. solution tree)? – Peter Wishart Mar 05 '12 at 12:19
  • they are included in the project, and in the case of c++ the headers are referenced in stdfx.h, and the implementations are referenced as needed starting from main. – gardian06 Mar 06 '12 at 19:28
0

After doing:

Tools >> Options >> Project and Solution >> Build and Run >> Check that "On run, when projects are out of date" is set to "Always build" or "Prompt to build" Build >> Configuration Manager >> Check that "Build" is checked for all of the projects you want to build for each of the configurations you need to use.

unchecking the flag "Only build startup projects and dependencies on Run" made the trick for me.

NonnoTeo
  • 11
  • 1
  • 2