tag:help.appveyor.com,2012-11-13:/discussions/problems/23706-visual-studio-project-fails-with-a-linker-errorAppVeyor: Discussion 2019-05-21T15:41:57Ztag:help.appveyor.com,2012-11-13:Comment/472835522019-05-21T12:31:52Z2019-05-21T12:46:12ZVisual Studio project fails with a linker error<div><p>Hi,<br>
I have a Visual Studio 2017 solution but the build fails with a linker error</p>
<pre>
<code>Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Release|x64".
Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" (1) is building "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
Creating directory "x64\Release\".
Creating directory "x64\Release\xpcPlugin.tlog\".
InitializeBuildStatus:
Creating "x64\Release\xpcPlugin.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
...
"C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" (default target) (1) ->
"C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.vcxproj" (default target) (2) ->
(Link target) ->
LINK : fatal error LNK1104: cannot open file 'libcpmt.lib' [C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.vcxproj]
50 Warning(s)
1 Error(s)
Time Elapsed 00:00:13.79</code>
</pre>
<p>The entire log can be accessed in this build<br>
<a href="https://ci.appveyor.com/project/JanC/xplaneconnect/builds/24695311">https://ci.appveyor.com/project/JanC/xplaneconnect/builds/24695311</a></p>
<p>I opened a <a href="https://www.appveyor.com/docs/how-to/rdp-to-build-worker/">RDP</a> connection to that build and the project compiles fine</p>
<pre>
<code>C:\projects\xplaneconnect\xpcPlugin>msbuild xpcPlugin/xpcPlugin.sln /p:Platform=x64 /p:Configuration=Release
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 5/21/2019 12:28:42 PM.
Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Release|x64".
Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" (1) is building "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.vcxproj" (2) on node 1 (default targets)
.
InitializeBuildStatus:
Creating "x64\Release\xpcPlugin.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
VcpkgTripletSelection:
Using triplet "x64-windows" from "C:\Tools\vcpkg\installed\x64-windows\"
ClCompile:
All outputs are up-to-date.
Link:
All outputs are up-to-date.
xpcPlugin.vcxproj -> C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\..\XPlaneConnect\64\win.xpl
AppLocalFromInstalled:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -noprofile -File "C:\Tools\vcpkg\scripts\buildsystems\msbuild\applocal.ps1" "C:\projects\xplaneconn
ect\xpcPlugin\xpcPlugin\..\XPlaneConnect\64\win.xpl" "C:\Tools\vcpkg\installed\x64-windows\bin" "x64\Release\xpcPlugin.tlog\xpcPlugin.write.1u.tlog" "x64\Release\vcpkg.applocal.log"
FinalizeBuildStatus:
Deleting file "x64\Release\xpcPlugin.tlog\unsuccessfulbuild".
Touching "x64\Release\xpcPlugin.tlog\xpcPlugin.lastbuildstate".
Done Building Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.vcxproj" (default targets).
Done Building Project "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:04.69
C:\projects\xplaneconnect\xpcPlugin></code>
</pre>
<p>My <code>.yml</code> file is</p>
<pre>
<code>branches:
only:
- appveyor
image: Visual Studio 2017
configuration: Release
platform:
- x64
build:
project: xpcPlugin/xpcPlugin/xpcPlugin.sln
verbosity: normal
on_finish:
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))</code>
</pre>
<p>Any idea what the problem could be?</p></div>Jantag:help.appveyor.com,2012-11-13:Comment/472835522019-05-21T13:37:09Z2019-05-21T13:37:10ZVisual Studio project fails with a linker error<div><p>I managed to reproduce it in the RDP by running</p>
<pre>
<code>"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" /verbosity:normal</code>
</pre>
<p>When I use the MSBuild.exe from the <code>MSBuild\14.0\</code> it builds fine</p>
<pre>
<code>"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "C:\projects\xplaneconnect\xpcPlugin\xpcPlugin\xpcPlugin.sln" /verbosity:normal</code>
</pre></div>Jantag:help.appveyor.com,2012-11-13:Comment/472835522019-05-21T13:57:50Z2019-05-21T13:58:07ZVisual Studio project fails with a linker error<div><p>ok I found the problem.</p>
<p>My MSVC <code>.sln</code> and <code>.vcxproj</code> were referencing VisualStudion 2015:</p>
<p>I needed to change<br></p>
<pre>
<code><Project DefaultTargets="Build" ToolsVersion="12.0"</code>
</pre>
to<br>
<pre>
<code><Project DefaultTargets="Build" ToolsVersion="14.0"</code>
</pre>
<p>and<br></p>
<pre>
<code>VisualStudioVersion = 12.0.31101.0</code>
</pre>
<p>to</p>
<pre>
<code>VisualStudioVersion = 15.0.28307.168</code>
</pre></div>Jantag:help.appveyor.com,2012-11-13:Comment/472835522019-05-21T15:41:55Z2019-05-21T15:41:55ZVisual Studio project fails with a linker error<div><p>Thanks for sharing!</p></div>Owen McDonnell