VS2010 static linking issue

前端 未结 4 1777
一向
一向 2020-12-31 13:21

my company has recently upgraded from VS2005 to VS2010. We have a huge project which uses a lot of modules which are being linked statically into the exe. But there seem to

4条回答
  •  旧时难觅i
    2020-12-31 13:46

    We starting seeing this issue again after moving to Visual Studio 2015 (and also in VS2017). The problem only seems to exist in the following configuration:

    Project (EXE)
      --> Static Library A (Reference)
        --> Static Library B (Specified in Linker->Additional Dependencies)
          --> Static Library C (Not in solution, specified in Linker->Additional Dependencies)
    

    There are several other projects in the solution that use A and B. When something in project B or C changes, many of these projects give LNK4099 warnings. In our case, the solution is to use the following:

    Code Generation > Output Files > Program Database File Name: $(TargetDir)$(TargetName).pdb

    Librarian > General > Output File: $(TargetDir)$(TargetName)$(TargetExt)

    $(TargetDir) uses an absolute path versus the default $(OutDir) which in our case was relative. It seems that the correct path gets lost with multiple levels of indirection.

    One interesting thing is if you switch the number of compile threads to 1, it doesn't appear to happen (maybe some kind of race condition within Visual Studio?).

提交回复
热议问题