Migrating code from VS 2005 to 2013 causes error LNK1104 error? - visual-studio-2013

I'm attempting to migrate a solution file from VS 2005 to VS 2013. The majority of the projects within the solutions rebuilt just fine.
However, some of the projects are coming up with the error:
error LINK1104: cannot open file 'mfc80.lib'
I have searched for mfc80.lib on my computer and it does not exist.
I cannot follow the solution from here fatal error LNK1104: cannot open file 'gdi32.lib' because the file does not exist, therefore I cannot add its path in "Additional Library Directories".
I have:
Deleted all the .obj and .lib files for the problematic project
Ensured Visual C++ MFC MBCS Library for Visual Studio 2013 is installed
Followed Error LNK1104 cannot open file ';.obj'
What else do I need to check?
Thanks.

It appears your project is attempting to include mfc80.lib explicitly. This is the version that VS2005 used; you need mfc120.lib.
Also, double-check that none of your source has a declaration like the following: #define _MFC_FILENAME_VER

Related

Building a C++ Visual Studio project in another IDE: fatal error afxwin.h

I downloaded this project's files which is written in visual studio and I am trying to make it compile in Code Blocks. The issue I am having, is with the StdAfx.h/.c files, which if I understand this correctly, are used for Visual studio.
So the error is:
fatal error: afxwin.h: No such file or directory
I get this error inside AtdAfx.h file, because it tried to include it:
#include <afxwin.h> // MFC core and standard components
If I try to delete the AtdAfx.h, my other project's files give me errors, since evey one of them uses the AtdAfx.h.
Side note:
This is the exact error I have Fatal error c1083 "afxwin.h" but he/she uses Visual studio, I use Code::Blocks.

Libjna build - LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'

I'm re-posting an issue from github (https://github.com/libffi/libffi/issues/538) I had since last week.
I'm currently having issue getting some JNA libraries built as jar deployables using Ant build script (FYI: https://github.com/thepaul/libjna-java). in order to use the APIs from this library for my other project. (The sole purpose of me going through the hassle building it is to be able to use its API. Due to lack of documentation and absence of existing build artifact provided, I had to do it myself. Importing the whole libjna repo as a project into my other project maybe another approach but I don't think it's appropriate. That said, if there're any better ways to use the libraries in libjna, do let me know!)
So here's what I did trying to build it into deployable jar file:
I already have the source project downloaded.
Tried to compile using Ant (which I downloaded the latest version) on cygwin. Failed because it requires libffi.
So I downloaded libffi source from here (https://github.com/libffi/libffi).
Tried to compile again using Ant. Failed because it couldn't find "/c/Program Files (x86)/Microsoft Visual Studio 9.0/vc/bin/cl" as mentioned in the config.log
So I inspected cc.sh and found that it refers to an older version of Microsoft Visual Studio. I have an existing installation of Visual Studio Express. So I changed the path to "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64" in cc.sh file.
Tried to complile again using Ant. Seemed the fix worked but failed with different error because it couldn't find "mspdbcore.dll". I found this file in "..\x86" so I copy the file across to ..\x64
Tried to compile again using Ant. Failed with similar error but different file because it couldn't find "mspdb140.dll". I found this file in "..\x86" so I copied over
Tried to compile again. Failed with different error because now it says
"LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'"
, although I could confirm this file is definitely in "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\lib\x64"
To tackle this error I tried (in vain):
adding microsoft visual studio paths to PATH
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64
C:\Program Files (x86)\Microsoft Visual
Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\lib\x64
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\Common7\IDE
Downloaded MS Visual Studio 2019 both Community and Professional (couldn't find those dlls for some reason)
Downloaded both mspdb140.dll and mspdbcore.dll separately, config.log says it can't find these files
Note I also did some research online, however:
I don't use visual studio IDE as I"m only trying to build it with Ant, so this post didn't really help much (LINK: fatal error LNK 1104: cannot open file 'LIBCMT.lib')
I don't really understand the answer to this post either (https://social.msdn.microsoft.com/Forums/en-US/cbedc1ba-c50b-499e-aa2e-12b0ce6a40ba/lnk1104-cannot-open-file-libcmtlib?forum=vclanguage)
So this is where I'm stuck.
See latest config log attached.
config.log
Also Ant build log attached.
ant_compile_error.txt
Anyone can help would be much appreciated!
Cheers
Dale

PVS Studio not working with MSVS not installed in default location

Due to disk size constraints, I installed MSVS 2017 to D:\Program Files\Visual Studio.
I then installed PVS-Studio v6.14. When I tried to run it, I get the following error messages:
Error was encountered while opening project 'MIDI2LR.vcxproj'. 0
Exception message: 0
Could not find a part of the path 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC'. 0
It also appears that PVS-Studio did install its extensions into the D:\Program Files\Visual Studio\Common7\IDE\Extensions\3ci0fu2p.p0x directory, so it appears that the installer found the executable.
How do I point PVS-Studio to the correct directories?
If I have understood correctly, we are talking about /Builds/VisualStudio2017/MIDI2LR.vcxproj from your repository (develop branch). If you're talking about another project, please specify it. The information is based on the analysis of the project I mentioned before.
Does this project compile on your machine? If a project does not compile, PVS-Studio does not guarantee the analysis. Otherwise, the analysis should be performed correctly. I also note that for the compilation you have to have the components Visual C++ Build Tools 2015 installed (in this context we use the contents of the directory C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC).
In this case, such behavior occurs because of your project's file structure – the PlatformToolset property is set with a value v140 before the import of Microsoft.Cpp.Default.props, thus this import is performed based on this toolset. This causes MSBuild to use the compiler from Visual C++ 2015, and not from Visual C++ 2017.
To compile using the compiler from VS2017 (V141 toolset), you need to modify the project file (see example of a console application project file that is created in Visual Studio 2017). Then the compilation should be done with a correct compiler and the analysis with PVS-Studio performed correctly.

can't build old VS2010 project with VS2013. (build tool for VS2010 cannot be found.)

I have installed VS2013 on my computer about 2 years ago(and removed VS2010 I guess) and today I tried to open my old VS2010 project (MV1.sln) that I used to work with about 5 years ago.
When I tried to open it, it just says "more than one project in the solution was not loaded correctly. refer to the output window"(translated from Korean). The output window says
D:\My_Path\MV1\MV1.vcxproj : error : can't read project file "MV1.vcxproj"
D:\My_Path\MV1\MV1.vcxproj(34,5): can't find imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 4.0.props". Check if the path specified in <import> declaration is correct and file exists in the disk.
So I checked the MV1.vcxproj file's line 34 which reads
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 4.0.props" />
which seems to be correct path because the value $(VCTargetsPath) is being used before line 34 in the same file and I can easily guess it points to C:\Program Files (x86)\MSBuild (I can see Microsoft.Cpp.props folder and BuildCustomizations\CUDA 4.0.props file referred to in the .vcxproj file)
I had CUDA4.0.props file which specifies include path and library path for CUDA4.0 under C:\Program Files (x86)\Microsoft Visual Studio 10.0 (I kept those files there at that time) but copied it to the location specified in vcxproj file to make it appear there.
I found some similar questions and answers but they seem to be different from my case. What can be the most correct method other than making a new project and copying and specifying everything one-by-one?
I found the file name should have a space in 'CUDA 4.0.props' so I changed the file name(MSBuild/Microsoft.Cpp/V120/BuildCustomizations/CUDA 4.0.targets) , then it complained about CUDA 4.0.targets file missing, so I copied MSBuild/Microsoft.Cpp/v4.0/BuildCustomizations/CUDA 4.0.targets (it was there since 5 years ago) to MSBuild/Microsoft.Cpp/v4.0/V120/BuildCustomizations/CUDA 4.0.targets. Now I can see the files in the project browser but when I build the project, it says
error MSB8020: The build tools for Visual Studio 2010 (Platform
Toolset = 'v100') cannot be found. To build using the v100 build
tools, please install Visual Studio 2010 build tools. Alternatively,
you may upgrade to the current Visual Studio tools by selecting the
Project menu or right-click the solution, and then selecting "Upgrade
Solution...". C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets 64 5 MV1
But in my VS2013 I don't see such "Upgrade Solution" or upgrade menu. So I looked for method to change the toolset and found
Visual Studio 2013 error MS8020 Build tools v140 cannot be found and seleted VS2013 and it tries to build now.
(though I have fix some errors cannot link external symbol _CUDAInit.. etc.)

Building Qt for Visual Studio 2010 - cannot open file 'qtmaind.lib'

I'm trying to start a C++ Qt application and have it run and compile in Visual Studio 2010.
Doing some googling, I found that there was a Visual Studio Qt Add-in, and so I installed this. I already had a MinGW Qt binary installed, and when this did not work, I found that you have to compile the source for Visual Studio 2010 (the VS 2008 binary will cause deployment issues).
Using this as a guide: How to build Qt for Visual Studio 2010, I compiled the open source version, and added it to the PATH, along with a QTDIR env variable. Hoping that I got it finally working, I created a "Qt Application" using the New Project Wizard in Visual Studio 2010. Once I finished, I tried to build the program, only to see the following error:
1>LINK : fatal error LNK1104: cannot open file 'qtmaind.lib'
I looked in the C:\QT\lib folder, and found that I only have a qtmaind.prl, but no clue as to why there is no qtmaind.lib.
I am able to echo the QMAKESPEC environmental variable to get a 'win32-msvc2010' output.
I've tried several different combinations of flags for the configure step, including the one in the link, and even tried manually setting the -platform flag.
If anyone can offer any help, it would be greatly appreciated! :D
Just ran across this same problem. I changed the "-release" flag from the linked guide to "-debug-and-release", and then it built the qtmaind.lib library (presumably, that "d" suffix stands for debug).
I encountered this issue when running a project whose settings were hardcoded for a particular machine setup.
I could see that the vcxproj file had something like:
C:\Qt\4.8.1\libqtmaind.lib
I could not find this lib file in my machine. I replaced the line by:
C:\Qt\4.7.3\lib\Qtmaind.lib
It looks like the names of library files are different across Qt versions.Or, maybe the library files were renamed.
Also, the 'd' denoted debug. If you cannot find any lib file post-fixed by 'd', it is likely that you did not 'make' a debug version of Qt.
You can cross check this by opening the .Sln file created by configure. Mine was named Projects.sln. You can open this in notepad and see if win32-debug configurations are present.
This might be a QMAKESPEC issue. Try setting your QMAKESPEC environment variable to
win32-msvc2010
and rebuild Qt like that. This should give you .lib files in your Qt folder
in QT 5.3 with vs 2013
in properties -> linker -> input
remove ANY path for qt libraries such qtmaind.lib
this is known BUG

Resources