Pregunta

I have a Visual Studio 2010 Ultimate C++ project (not managed or .NET). When I press F5 (i.e., start debugging), I want it to save all the files, rebuild those that changed, link the whole thing, and then run. Instead, it appears to use the last build. Thus, when I try to step into a function or something, I get the following error:

Visual Studio Changing Error

Based on my research, I have verified these options, the first three of which are in the Options dialog (can be reached under "Debug->Options and Settings"):

  • "Projects and Solutions->Build and Run->Only build startup projects and dependencies on Run" is checked. Some research indicated that it should be unchecked, but in my case I actually do only want it to rebuild the startup project. For what it's worth, I've tried unchecking it, with no effect.
  • "Projects and Solutions->Build and Run->On Run, when projects are out of date:" is set to "Always build".
  • "Debugging->Edit and Continue->Enable Edit and Continue" is checked, though it's greyed out.
  • In the Configuration Manager ("Build->Configuration Manager"), all solution configurations and platforms have their "Build" checkbox checked.

I have also tried deleting all Debug and Release directories as well as the .sdf and ipch directory.

For completeness, I suppose I should mention that I'm using precompiled headers, though I kinda doubt it matters.

Thanks,
Ian

[EDIT: I should note that it only seems to be one file (a .h file) that's doing it. I tried renaming it and recompiling, and also removing it from the solution and adding it back in, but it didn't work. ]

¿Fue útil?

Solución

Once I had similar problem with my C# project and I think I have tried every possible suggestion available on internet but none worked and then this is what I have done:

  1. Created an empty Project
  2. Added startup function to verify that it does not show any error
  3. Imported all my source code manually one by one

So, Yes, it was the solution. You already have done a lot so I would say you can get lucky by trying here and there however having a new project and importing your individual source file would be faster.

Otros consejos

I was able to bring my solution back into the right state after deleting all .suo and .csproj.user files. Answer led to this solution. Hope this saves someone time.

I fell into this state after installing Ultimate over Professional and running profiling tools.

Another solution could be that switching the platform. I noticed that when I when to project properties, the new project I had just created had a platform of 'win32' and my other projects in the same solution had it set at x64. After I switched my project to x64, everything worked just fine. This worked for my interop(C,C+, C#) project and hopefully works for other projects as well.

I have successfully resolved it, try the following:

  1. remove all temporary and intellisense files
  2. remove all project from solution and then add them back(most important)
  3. check projects 'Frameworks and References' to ensure they are valid
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top