Migrating from VS2010 to 2015 - False LNK2011
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Migrating from VS2010 to 2015 - False LNK2011

  1. #1
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    315

    Migrating from VS2010 to 2015 - False LNK2011

    Im migrating an aplication from VS2010 to VS2015. I downloaded the MSVS2015 for evaluation from Microsoft site and updated it with update 3. My solution has 4 projects one like a core that has all basic functions and the others are for specialized code that uses these functions from the core. On VS2010 everything is compiling and linking OK, but on VS2015 (I just opened the project from VS2010 on VS2015). Im getting a linker error that seems to be a false error:

    1>------ Rebuild All started: Project: CalcNS, Configuration: Release x64 ------
    1> stdafx.cpp
    1>F:\Arquivos de Programas (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\afx.h(38): warning C4996: 'MBCS_Support_Deprecated_In_MFC': MBCS support in MFC is deprecated and may be removed in a future version of MFC.
    1> F:\Arquivos de Programas (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\afx.h(33): note: see declaration of 'MBCS_Support_Deprecated_In_MFC'
    1> _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)
    1> CalcNS.cpp
    1> CCalcNS.cpp
    1> Generating Code...
    1> Creating library Release\CalcNS.lib and object Release\CalcNS.exp
    1>igualdades.obj : error LNK2011: precompiled object not linked in; image may not run
    1>Release\CalcNS.dll : fatal error LNK1120: 1 unresolved externals
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========


    The compiler is complainning about a precompiled file but this is not on precompiled files, none of mine files are.

    igualdades.obj is a file that is on the core project, external to CalcNS project. Im sure that the file exists and is on the correct place, acessible to CalcNS project. If I delete the igualdades.obj file the erros pointed by the compiler seems to be correct (the file is missing):

    1>------ Rebuild All started: Project: CalcNS, Configuration: Release x64 ------
    1> stdafx.cpp
    1>F:\Arquivos de Programas (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\afx.h(38): warning C4996: 'MBCS_Support_Deprecated_In_MFC': MBCS support in MFC is deprecated and may be removed in a future version of MFC.
    1> F:\Arquivos de Programas (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\afx.h(33): note: see declaration of 'MBCS_Support_Deprecated_In_MFC'
    1> _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)
    1> CalcNS.cpp
    1> CCalcNS.cpp
    1> Generating Code...
    1>LINK : fatal error LNK1181: cannot open input file 'igualdades.obj'
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    I have verified everything: paths, includes, rebuild all etc and cannot figure out what is wrong.

    Have anyone pass thru this, so please give me a hint how to get around this issue.
    Is this a MSVC 2015 issue???

    any help will be appreciated
    Last edited by Rabelo; February 12th, 2017 at 10:54 AM.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,783

    Re: Migrating from VS2010 to 2015 - False LNK2011

    igualdades.obj is a file that is on the core project, external to CalcNS project
    How is this .obj file produced?

    Have a look at https://msdn.microsoft.com/en-us/library/3ay26wa2.aspx which may be of help.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++17 Compiler: Microsoft VS2017 (15.4.0)

  3. #3
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    315

    Re: Migrating from VS2010 to 2015 - False LNK2011

    Thank you for your answer,

    It is generated on the core compilation. I comple first the core project, and then this project the CalcNS. I have already looked at this post on Microsoft site and that is just what Im doing. I compile first the core that generated the igualdades.obj and then compile the calcNS project that use it and it is included on the files to link on CalcNS project.
    Last edited by Rabelo; February 12th, 2017 at 01:24 PM.

  4. #4
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    315

    Re: Migrating from VS2010 to 2015 - False LNK2011

    Good (or bad) news

    If I change the platform (on configuration properties - General) toolset to VS2010 (v100) the program compiles OK...

  5. #5
    Join Date
    Feb 2017
    Posts
    3

    Re: Migrating from VS2010 to 2015 - False LNK2011

    Quote Originally Posted by Rabelo View Post
    Good (or bad) news

    If I change the platform (on configuration properties - General) toolset to VS2010 (v100) the program compiles OK...
    This just mean that VS 2010 compiler works fine with current setting; and you can continue using your application with VS2010 run time on the target platform.

    I had similar situation where VS2010 tool set works fine and VS2015 wouldn't. I took following approach:

    1) Set Suppress start up banner to no (so you can see all the compiler options in output windows) after that compare them for all the projects

    2) Define Windows Version in C/C++ -> Preprocessor Definitions WINVER=0x501 (based on your target machine verison)

    3) If there is any make file project make sure it is using VS2015 tools set (in my case there was one open source project that was keep using old tool set)

    I would also compile each library on it's own and fix new warning given by VS2015 compiler.

    I also noticed that the compiler options (in Project Settings) don't work well when projects are upgraded. You might have to fix them.

  6. #6
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    315

    Re: Migrating from VS2010 to 2015 - False LNK2011

    I tried do all you said but without sucess, I Aligned all properties of all projects but did not work. Digging on the internet I saw that this problem happens many times and seems to be an issue from MSVS2015. There is a make file from a third part but this dont seems to be the problem. The solution is linking with the DLLs generated on 2010 version but this is not what I want, I want to move to 2015

    I will try a litle more and let you know if I find something.

    Thank you very much.

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    18,967

    Re: Migrating from VS2010 to 2015 - False LNK2011

    Quote Originally Posted by Rabelo View Post
    ... The solution is linking with the DLLs generated on 2010 version but this is not what I want, I want to move to 2015
    Did you rebuild all the DLLs and other lib/obj files under VS2015?
    Victor Nijegorodov

  8. #8
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    315

    Re: Migrating from VS2010 to 2015 - False LNK2011

    Yes Victor,

    I cleaned all 6 projects and rebuild them 1 by 1, on the rigth order of course. I tested even deleting the Debug and the Release directory from all of them. Im not undestanding why the linker is complaining this file to be on the precompiled header. It is not part of the precompiled headers ( I use only stdafx.h as precompiled header on all projects). I also tested removing the precompiled header configuration from the project but did not work.

    Thank you,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)