VS2010 always relinks the project

前端 未结 2 1255
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 08:48

I am migrating a complex mixed C++/.NET solution from VS2008 to VS2010.

The upgraded solution works in VS2010, but the build system is always refere

相关标签:
2条回答
  • 2020-12-30 09:37

    Turns out the problem was that the PDB filename was defined under both the compiler settings and the linker settings (with the same name).

    This seemed to cause a problem in VS2010 as somehow an 'old' pdb from the intermediate directory (compiler output?) was being copied over the one in the output directory (linker output?). This resulted in the pdb in the output directory being older than some of the obj files and forcing the relink next time around (rinse and repeat).

    Clearing the pdb name settings seemed to fix the problem, and the defaults were fine.

    0 讨论(0)
  • 2020-12-30 09:52

    I'm just adding this for the record, in case anyone else gets this problem in the future.

    We had a similar problem with a large, mixed FORTRAN/C++ project relinking whether or not anything had changed. It seems to have started when the solution was upgraded from VS2008 to 2010, although no-one could quite remember.

    Eventually, I took a serious look at it (it was annoying, but not enough to do anything). By process of elimination, I have found the solution:

    Remove any quotes in the "Additional Library Directories" of the top-level FORTRAN project (i.e. the one that makes the executable).

    Now, I wouldn't believe this myself without evidence, so if you have the urge to reproduce this error yourself:

    1. Open a new VS2010 session.
    2. Create a new FORTRAN project that makes an executable.
    3. Leave it empty, but link it to a non-inbuilt lib file (i.e. one of your own), and add your library's directory to the Additional Library Directories.
    4. Check this compiles and links correctly.
    5. Now try adding double quotes (") around the directory, and click on "Build" several times. If your session is like mine, then it will relink every time. When you remove the quotes, it stops.

    This only appears to be a problem on the top-level project, and when those projects are FORTRAN - the quotes have no effect on C++ projects or those that create libs.

    The relinking does not occur if VS does not need to search for libs (for example, if all of your libs are inbuilt, like kernel32.lib), but will occur whether or not your lib is in the directory which has quotes or a different one.

    If anyone can justify this "feature", please let me know!

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