Make Issue with Pytorch Cpp example

Dennis_Hugle: <p>Dear Forum,</p>
<p>I tried this example here: <a href="https://pytorch.org/cppdocs/installing.html" class="inline-onebox" rel="noopener nofollow ugc">Installing C++ Distributions of PyTorch — PyTorch master documentation</a> and the first steps go well. However using “cmake --build . --config Release” leads to error 2210. The cmake command goes well at first, see:</p>
<pre><code class="lang-auto">
C:\Users\xxx\source\repos\torch_cpp\build&gt;cmake -DC_PREFIX_PATH=C:\Users\xxx\source\repos\torch_cpp\libtorch\ -DTorch_DIR=C:\Users\xxx\source\repos\torch_cpp\libtorch\share\cmake\Torch -DCMAKE_GENERATOR_PLATFORM=x64 ..

-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.12.25834.0
-- The CXX compiler identification is MSVC 19.12.25834.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 15.0/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 15.0/VC/Tools/MSVC/14.12.25827/bin/Hostx86/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1 (found version "10.1")
-- Caffe2: CUDA detected: 10.1
-- Caffe2: CUDA nvcc is: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe
-- Caffe2: CUDA toolkit directory: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1
-- Caffe2: Header version is: 10.1
-- Found CUDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/lib/x64/cudnn.lib
-- Found cuDNN: v8.0.5  (include: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/include, library: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/lib/x64/cudnn.lib)
-- Autodetected CUDA architecture(s):  5.0
-- Added CUDA NVCC flags for: -gencode;arch=compute_50,code=sm_50
CMake Warning (dev) at C:/Users/xxx/source/repos/torch_cpp/libtorch/share/cmake/Caffe2/public/cuda.cmake:491 (if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
  C:/Users/xxx/source/repos/torch_cpp/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
  C:/Users/xxx/source/repos/torch_cpp/libtorch/share/cmake/Torch/TorchConfig.cmake:40 (find_package)
  CMakeLists.txt:4 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/Users/xxx/source/repos/torch_cpp/libtorch/share/cmake/Torch/TorchConfig.cmake:121 (if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
  CMakeLists.txt:4 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Torch: C:/Users/xxx/source/repos/torch_cpp/libtorch/lib/torch.lib
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    C_PREFIX_PATH


-- Build files have been written to: C:/Users/xxx/source/repos/torch_cpp2/build

</code></pre>
<p>After that I used the <code>cmake --build . --config Release</code> command to compile the program, which failed like this:</p>
<pre><code class="lang-auto">C:\Users\xxx\source\repos\torch_cpp\libtorch\include\ATen/core/boxing/impl/boxing.h(150): error C2210: '_Ty': pack e
xpansions cannot be used as arguments to non-packed parameters in alias templates [C:\Users\xxx\source\repos\torch_c
pp\build\example-app.vcxproj]
C:\Users\xxx\source\repos\torch_cpp\libtorch\include\ATen/core/boxing/impl/boxing.h(150): error C2210: 'T': pack exp
ansions cannot be used as arguments to non-packed parameters in alias templates [C:\Users\xxx\source\repos\torch_cpp
\build\example-app.vcxproj]
C:\Users\xxxx\source\repos\torch_cpp\libtorch\include\ATen/core/boxing/impl/boxing.h(202): error C2210: '_Ty': pack e
xpansions cannot be used as arguments to non-packed parameters in alias templates [C:\Users\xxx\source\repos\torch_c
pp\build\example-app.vcxproj]
C:\Users\xxx\source\repos\torch_cpp\libtorch\include\ATen/core/boxing/impl/boxing.h(202): error C2210: 'T': pack exp
ansions cannot be used as arguments to non-packed parameters in alias templates [C:\Users\xxx\source\repos\torch_cpp
\build\example-app.vcxproj]
</code></pre>
<p>My Setup:</p>
<ul>
<li>Windows 10</li>
<li>Visual Studio 2017, cl version  19.12.25834</li>
<li>CuDNN 8.x &amp; Cuda v10.1</li>
</ul>
<p>I found a related post, where the advice was to use at least Visual Studio 2017, which I do. Can someone explain me what I did wrong?</p>
<p>Cheers!</p>