Why is Visual Studio 2008 always rebuilding my whole project?

前端 未结 18 1838
栀梦
栀梦 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:42

    A reason is if the 'date last modified' for one of the source file is set for some date in the future: it rebuilds, and then the source file is still later than the executable.

    This problem with the dates can happen if the source file is located in a directory a remote machine (a network share), and/or may even happen if your machine's time isn't synchronised with the date of the machine which is running the server of your source version control system.

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

    Had the same problem. Solved by: -delete output folder (obj,exe,all files) -run cygwin -cd project folder -run "touch *", which reset file modify date/time -build and enjoy problem fixed

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

    I've solved the same problem.

    In my case compiler displayed warning, that /Zi option is required if /Gm is specified.

    /Gm enables "minimum rebuild", which requires debug information in .pdb file. So, if you don't want to use .pdb, also disable minumum rebuild - it solved a problem in my case.

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

    After a couple days of googling, I ended up with a solution to my problem.

    I encountered this problem when I moved my projects to a new PC. I had checked several times the creation date of the files. These dates were up-to-date, however the modification dates were in the bast (kinda bizarre) even when I changed the files.

    A simple update of the files resolved the problem.

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

    Most probably is a matter of dependencies.

    Consider the following possibilities:

    • If you have custom build tools defined for some of the files in your solution, make sure that the output property contains the right file name(s). If the output of the build tool doesn't correspond to the one(s) specified in the output file names, the builder will rebuild that file.

    • If you have custom build events, check whether the output from those build events don't affect the dependencies of the files to be built.

    • I had problems when trying, at post-build, to copy or move some of the output files to a build folder. The post build operations that affect the timestamp of the ouput files of the build process will determine rebuild each time.

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

    In my case of such effect (C++ via VS2005) it was on Release configuration only, and the Studio tells in the build output, that compiler option /Gm is ignored if /Zi - option is not set. After setting /Zi via

    Configuration Properties -> C/C++ -> General -> Debug Information Format : Program Database (/Zi) ,

    it was ok. But isn`t there something wrong, when the Release Configuration needs something about Debugging? Not yet clear to me!

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