-
February 12th, 2017, 10:40 AM
#1
Migrating from VS2010 to 2015 - False LNK2011
I´m 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). I´m 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. I´m 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 11:54 AM.
-
February 12th, 2017, 11:57 AM
#2
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. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. 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/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
February 12th, 2017, 02:21 PM
#3
Re: Migrating from VS2010 to 2015 - False LNK2011
Thank you for your answer,
It is generated on the core compilation. I compÃ*le 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 I´m 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 02:24 PM.
-
February 14th, 2017, 04:55 AM
#4
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...
-
February 17th, 2017, 10:21 AM
#5
Re: Migrating from VS2010 to 2015 - False LNK2011
Originally Posted by Rabelo
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.
-
February 18th, 2017, 11:45 AM
#6
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 don´t 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.
-
February 18th, 2017, 12:50 PM
#7
Re: Migrating from VS2010 to 2015 - False LNK2011
Originally Posted by Rabelo
... 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
-
February 18th, 2017, 01:08 PM
#8
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. I´m 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|