How to run Visual Studio 2015 and 2017 on the same machine? - visual-studio

I installed Visual Studio Community 2015 on a server running Windows Server 2012 R2. I confirmed that the toolchain was able to build my C++ project (which uses CMake).
I then installed Visual Studio Community 2017 and confirmed that the toolchain was working as well. However, to my dismay, I soon discovered that the 2015 toolchain was no longer working. Trying to build my project resulted in the following errors:
-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Nathan/Documents/repositories/qmdnsengine/build/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_614a9\fast"
"C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\cmTC_614a9.dir\build.make
/nologo -L CMakeFiles\cmTC_614a9.dir\build
Building C object CMakeFiles/cmTC_614a9.dir/testCCompiler.c.obj
C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe
#C:\Users\Nathan\AppData\Local\Temp\2\nmB42E.tmp
testCCompiler.c
Linking C executable cmTC_614a9.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe
--intdir=CMakeFiles\cmTC_614a9.dir --manifests --
C:\PROGRA~2\MICROS~1.0\VC\bin\link.exe /nologo
#CMakeFiles\cmTC_614a9.dir\objects1.rsp
#C:\Users\Nathan\AppData\Local\Temp\2\nmB577.tmp
RC Pass 1 failed to run.
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' :
return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Nathan/Documents/repositories/qmdnsengine/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Nathan/Documents/repositories/qmdnsengine/build
What does this error mean and how would I go about fixing it?

Related

CMake using two different NDK, why is it broken?

I am trying to build the ceres-library on android.
I am following the instructions been given on the website, but I got stuck with an error and I don't understand why.
I am not an expert in building tools so I do apologize if my question is trivial but I'd like to know why it's not working.
Essentially what happens is that cmake for some reason is using the NDK I've installed with android studio but also the NDK that comes with visual studio if you enable the android development features.
My question first of all is why is using it both? (I would assume I have something broken in my setup but I cannot manage to fix it).
The command line I've been running is the following:
cmake -DCMAKE_TOOLCHAIN_FILE="C:\Users\l.gagliano\AppData\Local\Android\Sdk\ndk\16.1.4479499\build\cmake\android.toolchain.cmake" -DEigen3_DIR=D:\DEV\ceres\eigen\build -DANDROID_ABI=arm64-v8a -DANDROID_STL=c++_shared -DANDROID_NATIVE_API_LEVEL=android-21 -DBUILD_SHARED_LIBS=ON -DMINILOG=ON D:\DEV\ceres\ceres-solver-2.1.0
But I get the following output:
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Users/l.gagliano/AppData/Local/Android/Sdk/ndk/16.1.4479499/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Users/l.gagliano/AppData/Local/Android/Sdk/ndk/16.1.4479499/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
The C compiler
"C:/Users/l.gagliano/AppData/Local/Android/Sdk/ndk/16.1.4479499/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/DEV/ceres/ceres-android/CMakeFiles/CMakeScratch/TryCompile-lab0em
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/MSBuild/Current/Bin/MSBuild.exe cmTC_366ff.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
ANDROID_HOME=C:\\Microsoft\AndroidSDK\25
ANT_HOME=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Apps\apache-ant-1.9.3
JAVA_HOME=C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot
NDK_ROOT=C:\\Microsoft\AndroidNDK64\android-ndk-r16b
testCCompiler.c
In file included from <built-in>:327:
<command line>(3,9): warning : '__ANDROID_API__' macro redefined [-Wmacro-redefined] [D:\DEV\ceres\ceres-android\CMakeFiles\CMakeScratch\TryCompile-lab0em\cmTC_366ff.vcxproj]
#define __ANDROID_API__ 21
^
<command line>(1,9): note: previous definition is here
#define __ANDROID_API__ 19
^
1 warning generated.
C:\\Microsoft\AndroidNDK64\android-ndk-r16b\toolchains\x86_64-4.9\prebuilt\windows-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin\ld: error: cmTC_366ff.dir\Debug\testCCompiler.o: incompatible target
clang.exe: error: linker command failed with exit code 1 (use -v to see invocation)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Application Type\Android\3.0\Android.Common.targets(119,5): error MSB6006: "clang.exe" exited with code 1. [D:\DEV\ceres\ceres-android\CMakeFiles\CMakeScratch\TryCompile-lab0em\cmTC_366ff.vcxproj]
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:60 (project)
-- Configuring incomplete, errors occurred!
See also "D:/DEV/ceres/ceres-android/CMakeFiles/CMakeOutput.log".
See also "D:/DEV/ceres/ceres-android/CMakeFiles/CMakeError.log".
The command line comes from the example given in the Ceres Android section.
Obviously my end goal, apart from understanding the error, is actually fixing it so any suggestion would be appreciated.
This sorted:
cmake -G "Visual Studio 16" -A arm64 -DCMAKE_PREFIX_PATH=D:\DEV\ceres\gflags\build-gflags -DCMAKE_TOOLCHAIN_FILE="C:\Users\l.gagliano\AppData\Local\Android\Sdk\ndk\16.1.4479499\build\cmake\android.toolchain.cmake" -DEigen3_DIR=D:\DEV\ceres\eigen\build -DANDROID_ABI=arm64-v8a -DANDROID_STL=c++_shared -DANDROID_NATIVE_API_LEVEL=android-21 -DBUILD_SHARED_LIBS=ON -DMINIGLOG=ON D:\DEV\ceres\ceres-solver-2.1.0
Mainly the -G "Visual Studio 16" -A arm64 was the big deal.

ifort compiler not found by CMake

I'm using GitlabCI to perform some tests on a software library, which is supposed to provide multiplatform support. The compilation is performed by CMake, which is also supposed to detect compilers automatically. The problem is, that it's not able to detect ifort even when it's directly in the PATH.
My CMake version is 3.16.0-rc3.
.gitlab-ci.yml
win_visual_studio_2017_static_manual:
tags:
- Win
image: windows:latest
stage: build
variables:
DEPENDENCIES_LINK_TYPE: 'static'
before_script:
- 'rmdir /s /q build external_dependencies\*'
- 'call VsDevCmd.bat &&
call "C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2019.5.068\bin\psxevars.bat" intel64 vs2017 &&
copy /b NUL prep_success'
artifacts:
paths:
- 'prep_success'
expire_in: 5 mins
script:
- 'if not exist prep_success ( exit 1 )'
- 'where cl'
- 'where ifort'
- 'echo %cd%'
- 'echo %PATH%'
- 'call build_scripts\windows\win_VS_build_x64_release.bat'
Output
Running with gitlab-runner 11.8.0 (4745a6f3)
on win-ci1 Kh9rrkTg
Using Shell executor...
Running on WIN-CI1...
Fetching changes...
Removing prep_success
HEAD is now at 6008f3c [FIX] [WIN] Trying to fix CI on Windows
From https://code.it4i.cz/bes0030/mylib
6008f3c..58c3907 dev -> origin/dev
Checking out 58c3907d as dev...
Skipping Git submodules setup
$ rmdir /s /q build external_dependencies\*
The system cannot find the file specified.
The system cannot find the path specified.
$ call VsDevCmd.bat && call "C:\Program Files ^(x86^)\IntelSWTools\parallel_studio_xe_2019.5.068\bin\psxevars.bat" intel64 vs2017 && copy /b NUL prep_success
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
Intel(R) Parallel Studio XE 2019 Update 5
Copyright (C) 2009-2019 Intel Corporation. All rights reserved.
Intel(R) Compiler 19.0 Update 5 (package 281)
1 file(s) copied.
$ if not exist prep_success ( exit 1 )
$ where cl
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\Hostx86\x86\cl.exe
$ where ifort
C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2019.5.068\compilers_and_libraries_2019\windows\bin\intel64\ifort.exe
$ echo %cd%
C:\Gitlab-Runner\builds\Kh9rrkTg\0\bes0030\mylib
$ echo %PATH%
C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2019.5.068\compilers_and_libraries_2019\windows\bin\intel64;C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2019.5.068\compilers_and_libraries_2019\windows\bin;C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2019.5.068\compilers_and_libraries_2019\windows\redist\intel64\compiler;C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2019.5.068\compilers_and_libraries_2019\windows\redist\intel64_win\compiler;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\MSBuild\14.0\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\;C:\Gitlab-Runner\builds\Kh9rrkTg\0\bes0030\mylib\..\..\intel64\libfabric\bin\utils;C:\Gitlab-Runner\builds\Kh9rrkTg\0\bes0030\mylib\..\..\intel64\libfabric\bin;C:\Gitlab-Runner\builds\Kh9rrkTg\0\bes0030\mylib\..\..\intel64\bin\release;C:\Gitlab-Runner\builds\Kh9rrkTg\0\bes0030\mylib\..\..\intel64\bin;C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2019.5.068\compilers_and_libraries_2019\windows\ipp\..\redist\intel64\ipp;C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2019.5.068\compilers_and_libraries_2019\windows\redist\intel64_win\mkl;C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2019.5.068\compilers_and_libraries_2019\windows\redist\intel64_win\compiler;C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2019.5.068\compilers_and_libraries_2019\windows\tbb\bin\..\..\redist\intel64\tbb\vc_mt;C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2019.5.068\compilers_and_libraries_2019\windows\tbb\bin\..\..\redist\intel64\tbb\vc_mt;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\HostX86\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\Roslyn;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\\MSBuild\15.0\bin;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\;C:\Program Files\Microsoft MPI\Bin\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\CMake\bin;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
$ call build_scripts\windows\win_VS_build_x64_release.bat
-- Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.14393.
-- The C compiler identification is MSVC 19.15.26726.0
-- The CXX compiler identification is MSVC 19.15.26726.0
-- The Fortran compiler identification is unknown
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:2 (PROJECT):
No CMAKE_Fortran_COMPILER could be found.
-- Configuring incomplete, errors occurred!
See also "C:/Gitlab-Runner/builds/Kh9rrkTg/0/bes0030/mylib/build/CMakeFiles/CMakeOutput.log".
See also "C:/Gitlab-Runner/builds/Kh9rrkTg/0/bes0030/mylib/build/CMakeFiles/CMakeError.log".
Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: ALL_BUILD.vcxproj
ERROR: Job failed: exit status 1
As you can see, where ifort provides the path to ifort compiler, also PATH variable contains the same one in the very beginning. Still, CMake doesn't seem to detect the compiler. What can be wrong here? I don't want to specify the path to the compiler explicitly, if possible.

Qt Creator fails to open a CMake project due to a wrong link.exe path

I upgraded Visual Studio 2017 recently and now cannot open a CMake project in Qt Creator 4.8.2.
CMake succeeds to test the compiler when running from cmd.exe but fails in Qt Creator:
Running "C:\Program Files\CMake\bin\cmake.exe -E server "--pipe=\\.\pipe\{b2399ce2-b8c1-4992-94b7-57b65efed70f}" --experimental" in D:\checkout\mateju\integrace\util\itex\build_Qt5-Release.
Starting to parse CMake project.
The C compiler identification is MSVC 19.16.27027.1
The CXX compiler identification is MSVC 19.16.27027.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual
Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe" is
not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_1344c\fast"
"C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"
-f CMakeFiles\cmTC_1344c.dir\build.make /nologo -L
CMakeFiles\cmTC_1344c.dir\build
Building C object CMakeFiles/cmTC_1344c.dir/testCCompiler.c.obj
C:\PROGRA~2\MICROS~2\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\HostX64\x64\cl.exe
#C:\Users\MATEJU~1\AppData\Local\Temp\nmEB0D.tmp
testCCompiler.c
Linking C executable cmTC_1344c.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe
--intdir=CMakeFiles\cmTC_1344c.dir --manifests -- "C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\link.exe"
/nologo #CMakeFiles\cmTC_1344c.dir\objects1.rsp
#C:\Users\MATEJU~1\AppData\Local\Temp\nmEC75.tmp
LINK Pass 1 failed to run.
NMAKE : fatal error U1077: "C:\Program Files\CMake\bin\cmake.exe":
return code 0xffffffff
Stop.
NMAKE : fatal error U1077: "C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe":
return code 0x2
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
Configuring incomplete, errors occurred!
See also "D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeOutput.log".
See also "D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeError.log".
CMake Project parsing failed.
As you can see, the compiler path is:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64
However, it’s looking for the linker in the path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64
So my question is: How can I update the linker path to (the only existing) 14.16.27023? Or what else should I do to continue using CMake in Qt Creator?
I’ve tried to find a corresponding option in my Qt Creator Compiler options but it claims to use the same vcvarsall.bat call which works well on command-line…
D:\build>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.8
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
D:\build>link
Microsoft (R) Incremental Linker Version 14.16.27027.1
Copyright (C) Microsoft Corporation. All rights reserved.
<and so on...>
I’ve tried the following steps without any success:
add C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64 to PATH as the answer to a similar question suggests
launch Qt Creator from cmd.exe after running vcvarsall.bat in the same window
upgrade CMake to the latest stable version (3.14.1)
install and try in Qt Creator 4.9.0-rc1
search for the string 14.10.25017
in the Windows Registry – no results
in the Qt Creator directory
no configuration files found
found .pdb and .lib files which likely only means they were built using this version of Visual Studio
in C:\Program Files (x86)\Microsoft Visual Studio – no results
in C:\Program Files (x86)\Windows Kits – no results
After several unsuccessful guesses mentioned in the question, I succeeded to open, build and run my project after I issued
Build > Clear CMake Configuration
in the menu of Qt Creator.

VS 2010 and CMake: 'rc' is not recognized as an internal or external command

I'm trying to build a project on Windows 10 - Home using VS 2010 and CMake.
I'm getting the following errors:
zutil.c
lib -nologo -out:zlib.lib adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj
rc /dWIN32 /r /fozlib1.res ./win32/zlib1.rc
'rc' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'rc' : return code '0x1'
Stop.
*.dll
The system cannot find the file specified.
0 file(s) copied.
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
The system cannot find the file specified.
-- The C compiler identification is MSVC 16.0.40219.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake3.6/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Project/build/libpng-1.6.7-build/CMakeFiles/CMakeTmp
Does anyone know what the cause of:
'rc' is not recognized as an internal or external command,
operable program or batch file."
would be?
I'm assuming that's also causing the cl.exe is broken error?
The last time I had this problem was when my Visual Studio 2012 Professional standard installation did not install any Windows SDK (the error log was showing an missing SDK header).
To verify your SDK installation e.g. check that you have any Resource Compiler installed. It should be in a path similar to:
C:\Program Files (x86)\Microsoft SDKs\Windows\v[some version]\bin\RC.Exe
Since I was missing this - or more accurate any SDK - I installed Windows 8.1 SDK (since Visual Studio 2012 does target Windows 8.x) and voila my CMake was able again to compile the (test) programs. I think for Visual Studio 2010 the default would be the Windows 7.0a SDK and for Visual Studio 2015 it would be Windows 10 SDK with Universal C Runtime.
Reference
The CXX compiler identification is unknown
Visual Studio 2010 Express, Windows SDK 7.1, CMake and 64 bit

CMake Intel Fortran Compiler is not able to compile a simple program

I am using CMake to prepare a Fortran project under Windows. I have installed some inlet Fortran compiler with VC2015, and when I cmake have the following error
-- Check for working Fortran compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/ifc.exe
-- Check for working Fortran compiler: D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/ifc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeTestFortranCompiler.cmake:54 (message):
The Fortran compiler "D:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/bin/ifc.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/Dev/plaf/build/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_f7da8\fast"
"D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f
CMakeFiles\cmTC_f7da8.dir\build.make /nologo -L
CMakeFiles\cmTC_f7da8.dir\build
Building Fortran object
CMakeFiles/cmTC_f7da8.dir/testFortranCompiler.f.obj
"D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\ifc.exe" -c
D:\Dev\plaf\build\CMakeFiles\CMakeTmp\testFortranCompiler.f -o
CMakeFiles\cmTC_f7da8.dir\testFortranCompiler.f.obj
usage: D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\ifc.exe
[subcommand] [options...]
subcommands:
OBJ Convert an interface file into a dummy object file which can be archived into a static lib.
EMBED Embed an interface file into an existing static lib, producing a new lib.
EXTRACT Extract an embedded interface file from an existing static lib, producing the ifc.
LOCATE Find all embedded interface files and print their offset + size to stdout.
NMAKE : fatal error U1077: '"D:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\bin\ifc.exe"' : return code '0x1'
My understanding of the error (correct me if I am wrong), is that cmake is using the compiler with the wrong flags, hence during the sample program compilation it just doesn't work.
How can I fix that ? (The error seems different from what I have seen in most other posts)
it happened by me when I used MinGW to compile. The solution is to choose "MinGW Makefiles" instead of Visual Studio in the configure of CMake

Resources