none
Link Library Dependencies not working?

    Question

  • When I create a simple console application and a static library, I get 'Unresolved external symbols' when trying to compile/link the application.  I have my dependencies set, and the 'Link Library Dependencies' is set to Yes in the properties.  I have encountered this on 3 separate machines now, and can recreate it from scratch.  Is this a known issue?  If it is, when can we expect a patch?

     

    As a workaround, I have placed the .lib file in the additional libraries property, which seems to work for now.  VS2005 and VS2008 did not have this problem ;(


    flevine
    • Moved by Brittany Behrens Tuesday, May 18, 2010 7:08 AM (From:Visual Studio Editor)
    Tuesday, May 18, 2010 1:27 AM

Answers

  • Did you use project to project reference to set the build dependency? You can take a look of this blog:http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx

     

    Solution Dependencies into Project to project reference

    When a C++ application from a previous version of Visual Studio is converted to VS2010, project dependencies defined at the solution level are converted to project to project references. This change ensures that C++ project dependencies are captured in the project file. Below is how a Project to project reference looks in the project file:

    <ItemGroup>

        <ProjectReference Include="..\Cpp\Cpp.vcxproj">

          <Project>{c58574bf-9dd8-4cf8-b5b6-6551f2f3eece}</Project>

          <ReferenceOutputAssembly>false</ReferenceOutputAssembly>

        </ProjectReference>

      </ItemGroup>

     

    There are several advantages of having dependency information in the project file. First, user can build a project without the solution and the dependent projects will be built automatically. Second, it sets up the customer for large trees, where they might not use solution files. In addition, many customers have several solution files, each with different subsets of the projects. This can save the customers from setting project dependencies for each of the solutions. Another important factor is that, build dependencies are more reliable when the dependencies are set through project to project reference, especially when building with multiple cores.  This has been the case with previous versions of Visual Studio as well.

    -If you have a C# application that is dependent on a C++ application and this dependency is only expressed through solution dependency, the current conversion process won’t change the solution dependencies to the project to project references. You may run into build errors caused by incorrect build orders especially when building at the command line with MSBuild directly. To fix the issue, you will need to manually se up a proper project to project reference for C# and C++ applications.

                    -Use project to project reference instead of solution dependencies when setting up new build dependencies in VS2010 in general.

    Li Shao, MSFT


    Li Shao
    Wednesday, June 09, 2010 1:10 AM

All replies

  • The project dependencies have been a bit more problematic in VS2010 as it seems as if setting project x depends on project y doesn't cause it to link to it automatically anymore.

    You can check this http://blogs.msdn.com/vcblog/archive/2010/05/03/flexible-project-to-project-references.aspx to see if it helps.


    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.
    Visit my (not very good) blog at
    http://c2kblog.blogspot.com/
    Tuesday, May 18, 2010 10:28 AM
  • Hello Flevine,

    I cannot reproduce the issue on my box, please try crescens2k's suggestion. If it doesn't work for you, could you please show us the detailed steps to reproduce the issue?

    Regards,
    Rong-Chun Zhang
    MSDN Subscriber Supportin Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, May 18, 2010 11:46 AM
  • I will check it out and get back to you.  Thanks.

    flevine
    Wednesday, May 19, 2010 3:05 AM
  • Hello

    Have you got any progress on this issue?

    Regards,
    Rong-Chun Zhang
    MSDN Subscriber Supportin Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, May 26, 2010 8:35 AM
  • Rong-Chun,

    I read the blog link given in crescens2k's post.  I realized there exists in two places the "Link Library Dependences" option.  One is under "Common Properties" when a static library project is added as a reference, the other is under "Configuration Properties"->Linker->General.  It seems to be that the latter one has no effect.

    Having figured this out, I encountered another problem.  If the referenced project is a dll project, I get a link error LNK1104 in the referencing project.  Is there a workaround to it?

    Regards,
    XZ


    x.m
    Saturday, June 05, 2010 5:11 PM
  • Did you use project to project reference to set the build dependency? You can take a look of this blog:http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx

     

    Solution Dependencies into Project to project reference

    When a C++ application from a previous version of Visual Studio is converted to VS2010, project dependencies defined at the solution level are converted to project to project references. This change ensures that C++ project dependencies are captured in the project file. Below is how a Project to project reference looks in the project file:

    <ItemGroup>

        <ProjectReference Include="..\Cpp\Cpp.vcxproj">

          <Project>{c58574bf-9dd8-4cf8-b5b6-6551f2f3eece}</Project>

          <ReferenceOutputAssembly>false</ReferenceOutputAssembly>

        </ProjectReference>

      </ItemGroup>

     

    There are several advantages of having dependency information in the project file. First, user can build a project without the solution and the dependent projects will be built automatically. Second, it sets up the customer for large trees, where they might not use solution files. In addition, many customers have several solution files, each with different subsets of the projects. This can save the customers from setting project dependencies for each of the solutions. Another important factor is that, build dependencies are more reliable when the dependencies are set through project to project reference, especially when building with multiple cores.  This has been the case with previous versions of Visual Studio as well.

    -If you have a C# application that is dependent on a C++ application and this dependency is only expressed through solution dependency, the current conversion process won’t change the solution dependencies to the project to project references. You may run into build errors caused by incorrect build orders especially when building at the command line with MSBuild directly. To fix the issue, you will need to manually se up a proper project to project reference for C# and C++ applications.

                    -Use project to project reference instead of solution dependencies when setting up new build dependencies in VS2010 in general.

    Li Shao, MSFT


    Li Shao
    Wednesday, June 09, 2010 1:10 AM
  • I do not know what has to do the reply from Li Shao with the question. This seems to be something similar to Yahoo! Answers. One person ask something and he gets a completely non-related answer. And ALWAYS a copy and paste of the first answer when it is asked again. This doesn't help at all!

     

    Paco.

    Friday, November 25, 2011 10:16 AM