I am trying to build Caffe under Windows for further use in my C ++ project. Follow the instructions on github .

I have installed Visual Studio 2017. The path to the cl.exe file is the following: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\ cl.exe

CMake version 3.14.3 is also installed.

When running the build_win.cmd script, an error occurs:

CMake Error: Could not create named generator Visual Studio 14 2017 Win64.

Full output:

 C:\Users\Lenovo\Desktop\caffe>scripts\build_win.cmd Системе не удается найти указанный диск. Системе не удается найти указанный диск. INFO: ============================================================ INFO: Summary: INFO: ============================================================ INFO: MSVC_VERSION = 14 INFO: WITH_NINJA = 0 INFO: CMAKE_GENERATOR = "Visual Studio 14 2017 Win64" INFO: CPU_ONLY = 1 INFO: CUDA_ARCH_NAME = Auto INFO: CMAKE_CONFIG = Release INFO: USE_NCCL = 0 INFO: CMAKE_BUILD_SHARED_LIBS = 0 INFO: PYTHON_VERSION = 2 INFO: BUILD_PYTHON = 0 INFO: BUILD_PYTHON_LAYER = 1 INFO: BUILD_MATLAB = 0 INFO: PYTHON_EXE = "python" INFO: RUN_TESTS = 0 INFO: RUN_LINT = 0 INFO: RUN_INSTALL = 0 INFO: ============================================================ Системе не удается найти указанный путь. CMake Error: Could not create named generator Visual Studio 14 2017 Win64 Generators Visual Studio 16 2019 = Generates Visual Studio 2019 project files. Use -A option to specify architecture. * Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files. Optional [arch] can be "Win64" or "IA64". Visual Studio 9 2008 [arch] = Generates Visual Studio 2008 project files. Optional [arch] can be "Win64" or "IA64". Borland Makefiles = Generates Borland makefiles. NMake Makefiles = Generates NMake makefiles. NMake Makefiles JOM = Generates JOM makefiles. Green Hills MULTI = Generates Green Hills MULTI files (experimental, work-in-progress). MSYS Makefiles = Generates MSYS makefiles. MinGW Makefiles = Generates a make file for use with mingw32-make. Unix Makefiles = Generates standard UNIX makefiles. Ninja = Generates build.ninja files. Watcom WMake = Generates Watcom WMake makefiles. CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files. CodeBlocks - NMake Makefiles = Generates CodeBlocks project files. CodeBlocks - NMake Makefiles JOM = Generates CodeBlocks project files. CodeBlocks - Ninja = Generates CodeBlocks project files. CodeBlocks - Unix Makefiles = Generates CodeBlocks project files. CodeLite - MinGW Makefiles = Generates CodeLite project files. CodeLite - NMake Makefiles = Generates CodeLite project files. CodeLite - Ninja = Generates CodeLite project files. CodeLite - Unix Makefiles = Generates CodeLite project files. Sublime Text 2 - MinGW Makefiles = Generates Sublime Text 2 project files. Sublime Text 2 - NMake Makefiles = Generates Sublime Text 2 project files. Sublime Text 2 - Ninja = Generates Sublime Text 2 project files. Sublime Text 2 - Unix Makefiles = Generates Sublime Text 2 project files. Kate - MinGW Makefiles = Generates Kate project files. Kate - NMake Makefiles = Generates Kate project files. Kate - Ninja = Generates Kate project files. Kate - Unix Makefiles = Generates Kate project files. Eclipse CDT4 - NMake Makefiles = Generates Eclipse CDT 4.0 project files. Eclipse CDT4 - MinGW Makefiles = Generates Eclipse CDT 4.0 project files. Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files. Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files. ERROR: Configure failed 

Script content: https://pastebin.com/XqZfP18u

How to fix the error?

PS: Perform a CPU-only build. No CUDA installed.

    1 answer 1

    a small typo in the script, you need to fix the studio version:

      if "%MSVC_VERSION%"=="14" ( set CMAKE_GENERATOR=Visual Studio 14 2017 Win64 ) 

    on

      if "%MSVC_VERSION%"=="14" ( set CMAKE_GENERATOR=Visual Studio 14 2015 Win64 ) 

    Important! The library can only be built by Visual Studio 2015

    • Thank. This problem was solved, but a new one appeared. Apparently, the assembly is assumed using VS 2015 (after all, it’s this version that is indicated in the instructions), since The script writes: CMake Error: Error: generator : Visual Studio 15 2017 Win64 Does not match the generator used previously: Visual Studio 14 2015 Win64 Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory. - D .Stark
    • Is it possible to do something from the side without installing a studio in 2015? - D .Stark
    • Yes, as I already wrote, it is necessary to replace this line here: if NOT DEFINED MSVC_VERSION set MSVC_VERSION = 15 - Alexey Nikolaev
    • I replaced. INFO: MSVC_VERSION = 15 INFO: CMAKE_GENERATOR = "Visual Studio 15 2017 Win64" is part of the output. - D .Stark
    • one
      After configuring the project, open the caffe caffe-windows\scripts\build\Caffe.sln and execute the Build command for the runtest project. In the Output window you can see the results of the unit-test run: 3> [==========] 1106 tests from 150 test cases ran. (43389 ms total) 3> [ PASSED ] 1106 tests. 3> [==========] 1106 tests from 150 test cases ran. (43389 ms total) 3> [ PASSED ] 1106 tests. - Alexey Nikolaev