Answer the question
In order to leave comments, you need to log in
How to set up ninja on windows?
I'm trying to build hello world with ninja. I launch cmake -G Ninja ..
and then immediately appears
-- The CXX compiler identification is MSVC 19.28.29913.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: F:/microsoft/visual_studio/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: F:/microsoft/visual_studio/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - broken
CMake Error at F:/tools/cmake/share/cmake-3.20/Modules/CMakeTestCXXCompiler.cmake:59 (message):
The C++ compiler
"F:/microsoft/visual_studio/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: F:/code/C++/OOP/lab5/build/CMakeFiles/CMakeTmp
Run Build Command(s):F:/tools/Qt/Tools/Ninja/ninja.exe cmTC_0aebd && [1/2] Building CXX object CMakeFiles\cmTC_0aebd.dir\testCXXCompiler.cxx.obj
[2/2] Linking CXX executable cmTC_0aebd.exe
FAILED: cmTC_0aebd.exe
cmd.exe /C "cd . && F:\tools\cmake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_0aebd.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- F:\microsoft\visual_studio\VC\Tools\MSVC\14.28.29910\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_0aebd.dir\testCXXCompiler.cxx.obj /out:cmTC_0aebd.exe /implib:cmTC_0aebd.lib /pdb:cmTC_0aebd.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
RC Pass 1: command "rc /fo CMakeFiles\cmTC_0aebd.dir/manifest.res CMakeFiles\cmTC_0aebd.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified
ninja: build stopped: subcommand failed.
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: F:/microsoft/visual_studio/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe
Build flags: /DWIN32;/D_WINDOWS;/W3;/GR;/EHsc
Id flags:
The output was:
2
Оптимизирующий компилятор Microsoft (R) C/C++ версии 19.28.29913 для x64
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.
CMakeCXXCompilerId.cpp
Microsoft (R) Incremental Linker Version 14.28.29913.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:CMakeCXXCompilerId.exe
CMakeCXXCompilerId.obj
LINK : fatal error LNK1104: не удается открыть файл "LIBCMT.lib"
Detecting CXX compiler ABI info failed to compile with the following output:
Change Dir: F:/code/C++/OOP/lab5/build/CMakeFiles/CMakeTmp
Run Build Command(s):F:/tools/Qt/Tools/Ninja/ninja.exe cmTC_24677 && [1/2] Building CXX object CMakeFiles\cmTC_24677.dir\CMakeCXXCompilerABI.cpp.obj
Примечание: включение файла: F:\tools\cmake\share\cmake-3.20\Modules\CMakeCompilerABI.h
[2/2] Linking CXX executable cmTC_24677.exe
FAILED: cmTC_24677.exe
cmd.exe /C "cd . && F:\tools\cmake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_24677.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- F:\microsoft\visual_studio\VC\Tools\MSVC\14.28.29910\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_24677.dir\CMakeCXXCompilerABI.cpp.obj /out:cmTC_24677.exe /implib:cmTC_24677.lib /pdb:cmTC_24677.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
RC Pass 1: command "rc /fo CMakeFiles\cmTC_24677.dir/manifest.res CMakeFiles\cmTC_24677.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified
ninja: build stopped: subcommand failed.
Answer the question
In order to leave comments, you need to log in
When installing MSVS, several batch files are installed along with it, which set up the build environment.
In my MSVS 2017 they are called "Native tools command promtp ...". In other versions of MSVS, the name may change slightly. The batch files are located in the Start menu in the MSVS folder.
Run the appropriate batch file, it will set up the build environment and launch the command line. From there, build your project. In this case, no manual settings are required.
PS: you shouldn't have installed MSVS in a directory other than the default - there can be hard-to-diagnose problems when building from the command line. Perhaps you just encountered this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question