What does Linker Dependency Link Link Dependency do in Visual Studio 2010?

Prior to VS2008, you install your project-specific C ++ native in the solution file ( Project Dependencies ... ), and if (by default) the linker parameter

 Properties -> Linker -> General : Link Library Dependencies = Yes 

Visual Studio Build will automatically link in the .lib files of all projects (DLL, LIB) in which this project depends, will be "statically" linked.




Side Note. Microsoft has changed the work of dependencies in VS2010 , and now you must add the dependency directly to the project

 Common Properties -> Framework and References : (List of depenencies) (each lib/dll has a separate option: Project Reference Properties -> Link Library Dependencies : True|False 

I'm fine. This is not what it is about.

(One explanation here: Flexible references to project project .)




However, it is still possible to determine the dependencies of the project on the solution level, and the General Linker parameter also still exists. However, this will not work. Cm:

  • Link library dependencies not working?
  • Has Visual Studio 2010 developed “Project Dependencies” between C ++ projects?
  • Visual Studio 2010 does not autolize static libraries from projects that depend on how it should be provided.
    • "but, strangely enough, without removing the old user interface or in any way indicating that it no longer works"

and especially see here (acutal question follows)

If Microsoft confirms that the Linker Option is not doing what the world’s population expects of it, and adds the following explanation:

Thanks for reporting this feedback. The problem you are facing is the design. “Link library dependency” is a flag that only dictates whether or not to transfer the library as an input to the linker. It does not find dependency automatically. As a customer, you will have to define the manual handling as you suggest.

Can it explain what this means , or more: what does the Link Library Dependency linker option do in Visual Studio 2010?

What is linker entry that is not actually connected?

+45
visual-c ++ linker visual-studio-2010 dependencies projects-and-solutions
Oct 07 '11 at 6:44
source share
5 answers

2017 Re-Run. Yay

TL; DR

This parameter sets the default value (a) for the actual Link Library Dependecies for each project link. If every link to a project has LinkLibraryDependecies , then this is virtually pointless.

However, when adding a new default link (in VS2010 and 2015), the new <ProjectReference> element in the vcxproj file does not have a set set, therefore this parameter is important because it provides a default value for all newly added links if their value does not change.

(a): It really should be the same for all configurations (Debug / Release) and Platforms (Win32 / x64), or everything becomes very complicated.

Mountain Details

Hans pointed out that it seems to be doing nothing in VS2010 as such . However, this does not mean that it is not actually used by VS / MSBuild.

The bottom line is how this parameter is inserted into the vcxprj file and how the default settings work for the <ProjectReference> parameter in the msbuild file.

The setting in the Linker dialog box, as shown above, is inserted as:

Not actually implemented

 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> ... <ItemDefinitionGroup> <ClCompile> ... </ClCompile> <Link> ... </Link> <ProjectReference> <LinkLibraryDependencies>This option is not used by VS 2010!</LinkLibraryDependencies> </ProjectReference> ... </ItemDefinitionGroup> </Project> 

And although it seems to be somehow grouped together with the Link option, which just confuses you.

What this actually does in this vcxproj file (or when exiting the .props file): set the default Link Library Dependencies The value for each project dependency on the Frameworks and References section in the VS2010 VC settings dialog box is

Link Lib in 2010 links

- or in the VS2015 link subtree -

Link Lib in links 2015

And this is relevant, because when you add a new link to the project, the default entry in your vcxproj file will look like this:

 ... <ItemGroup> <ProjectReference Include="..\W32DynLib1\W32DynLib1.vcxproj"> <Project>{96be134d-acb5-....-....-....bb6fe4a7}</Project> </ProjectReference> </ItemGroup> 

You will notice that there is no sub element <LinkLibraryDependecies>true|false</..> : This means that a "global" setting will be used to set the default value.

If your global setting is false (or No ), the link to the project will not be in anything. If it is true , it will be referenced.

What else:

  • If this parameter, LinkLibraryDependency , is completely absent in your settings, it will default to true (from the Microsoft.Cpp[.Common].props in the MSBuild folder).
  • If you have This is not used in your global setting, this will be interpreted as true.
  • If you have the value False is the new truth! or perhaps No way in this parameter, it will also be interpreted as built.]
  • A warning will appear in the VS2015 GUI if it cannot interpret the line here: String value
  • The VS2010 GUI will display False for ALL values ​​except false , although this is interpreted as true when building the project.

What is more:

It seems that when converting old solutions with vcproj files vcproj converter will take the old dependencies that were specified in sln and the value of the project parameter vcproj , and in fact set the LinkLibraryDependency for each ProjectReference it inserts into the new vcxproj - this is one of the reasons why I I thought it’s a dead option for so long - most of our projects have a conversion history related to VS2005.

+3
Oct 20 '17 at 7:54 on
source share

You must give the setting the correct value to ensure clarity:

enter image description here

+37
Oct 07 '11 at 9:25 a.m.
source share

Here you need to go, project properties → general properties → frames and links, and then add a new link to your projects. Then only it will work in VS 2010 not like in the earlier versions of VS

+6
Nov 17 '12 at 20:37
source share

This should be set to Properties / Common / Frameworks and References

Alternatively, you can add something like the one below in the vcxproj file, of course, use the actual project you are referencing and the uuid of this project.

 <ItemGroup> <ProjectReference Include="..\Cpp\Cpp.vcxproj"> <Project>{c58574bf-9dd8-4cf8-b5b6-6551f2f3eece}</Project> </ProjectReference> </ItemGroup> 
+5
Feb 12 '13 at 8:21
source share

It seems you also need to install

 <IgnoreImportLibrary>false</IgnoreImportLibrary> 

in the REFERENCED project.

+3
Nov 22 '13 at 21:16
source share



All Articles