Why is Visual Studio 2008 always rebuilding my whole project?

前端 未结 18 1782
栀梦
栀梦 2021-02-05 18:22

I have a Visual Studio project with about 60 C++ source files. I can do a build, and it completes without errors. But if I immediately hit F7 again, it always re-compiles about

相关标签:
18条回答
  • 2021-02-05 18:46

    Disabling "minimal rebuild" (Configuration Properties > C/C++ > Code Generation) fixed it for me. The compiler even left a clue:

    1>cl : Command line warning D9007 : '/Gm' requires '/Zi or /ZI'; option ignored

    Although I must point out, the compiler did not ignore the option as it said.

    0 讨论(0)
  • 2021-02-05 18:47

    Check your project includes any .h header file that doesn't exist on disk. Always happens to me when I delete a header file I'm not actually including anywhere, but forget to delete it from my solution navigator in VS. Note: missing headers produce no errors during the build (when not #included anywhere).

    0 讨论(0)
  • 2021-02-05 18:48

    It seems that this problem can be caused by many things, but what fixed it for me was:

    1. Closing Visual Studio
    2. Manually deleting all bin and obj folders (Clean doesn't seem to do the trick)
    3. Opening the solution and running Clean (I'm not sure if this is necessary, but I did it just in case...)
    4. Building like normal

    Note: This was for a C# program in Visual Studio 2010.

    0 讨论(0)
  • 2021-02-05 18:48

    I'm having the same problem, and it seems to be because I've turned browse information off. Properties->C/C++->Browse Info->Enable Browse Info->None. The only fix I've found is turning it back on. This is for an xbox 360 project, fwiw, my other projects don't have the problem.

    0 讨论(0)
  • 2021-02-05 18:52

    Check your project's Program Database Filename setting. For some reason, if this is set to the name of a directory (such as "$(IntDir)\"), it can sometimes cause VS to rebuild your project every time, even if you're not generating PDB files (i.e. Debug Information Format is set to "Disabled").

    This is a bug in VS2008; I have not yet reproduced it yet in VS2010, but my tests haven't been thorough, so I'm not confident saying that the behavior isn't present in VS2010.

    0 讨论(0)
  • 2021-02-05 18:55

    What caused similar symptoms at me was: I have several projects in a solution. There were .cpp files which were referenced (and therefore compiled) by >1 projects. Unfortunately Visual Studio creates .obj files with a very simple naming - it just replaces ".cpp" by ".obj". Creating wrapper .cpp-s with different named solved the problem.

    0 讨论(0)
提交回复
热议问题