<p dir="auto">Hi ,<br>
compiled ‘setup.py’  in dir 'cuda' of  extension-cpp-master  and got  2 erros like that:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/18642811/56650882-83a3a180-66ba-11e9-866e-6301b23e63cd.png"><img src="https://user-images.githubusercontent.com/18642811/56650882-83a3a180-66ba-11e9-866e-6301b23e63cd.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">ran it in torch1.0,1 , win7-x64<br>
help pls!<br>
regards</p>
<h2 dir="auto">Issue description</h2>
<p dir="auto">Building a custom CUDA extension fails with the following error on MSVC 2017:<br>
<code class="notranslate">&lt;env_lib_dir&gt;\site-packages\torch\lib\include\pybind11\cast.h(1393): error: expression must be a pointer to a complete object type</code></p>
<p dir="auto">However, I have not observed the error with multiple GCC versions on Linux.</p>
<h2 dir="auto">Code example</h2>
<p dir="auto">Here is an MWE.</p>
<p dir="auto">setup.py</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import os
from setuptools import setup
from torch.utils.cpp_extension import CppExtension, CUDAExtension, BuildExtension

setup(name='exten', ext_modules=[
    CUDAExtension('exten_cuda', ['exten_cuda.cpp', 'exten_cuda_kernel.cu'])
    ], cmdclass={'build_ext': BuildExtension})"><pre class="notranslate"><code class="notranslate">import os
from setuptools import setup
from torch.utils.cpp_extension import CppExtension, CUDAExtension, BuildExtension

setup(name='exten', ext_modules=[
    CUDAExtension('exten_cuda', ['exten_cuda.cpp', 'exten_cuda_kernel.cu'])
    ], cmdclass={'build_ext': BuildExtension})
</code></pre></div>
<p dir="auto">exten_cuda.cpp</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="std::vector&lt;at::Tensor&gt; exten_cuda_forward(at::Tensor a);
std::vector&lt;at::Tensor&gt; exten_cuda_backward(at::Tensor a);

std::vector&lt;at::Tensor&gt; exten_forward(at::Tensor a) {
  return exten_cuda_forward(a);
}

std::vector&lt;at::Tensor&gt; exten_backward(at::Tensor a) {
  return exten_cuda_backward(a);
}

// Do Python bindings.
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
  m.def(&quot;forward&quot;, &amp;exten_forward, &quot;Extension forward CUDA&quot;);
  m.def(&quot;backward&quot;, &amp;exten_backward, &quot;Extension backward CUDA&quot;);
}"><pre class="notranslate"><code class="notranslate">std::vector&lt;at::Tensor&gt; exten_cuda_forward(at::Tensor a);
std::vector&lt;at::Tensor&gt; exten_cuda_backward(at::Tensor a);

std::vector&lt;at::Tensor&gt; exten_forward(at::Tensor a) {
  return exten_cuda_forward(a);
}

std::vector&lt;at::Tensor&gt; exten_backward(at::Tensor a) {
  return exten_cuda_backward(a);
}

// Do Python bindings.
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
  m.def("forward", &amp;exten_forward, "Extension forward CUDA");
  m.def("backward", &amp;exten_backward, "Extension backward CUDA");
}
</code></pre></div>
<p dir="auto">exten_cuda_kernel.cu</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#include &lt;torch/torch.h&gt;
#include &lt;cuda.h&gt;
#include &lt;cuda_runtime.h&gt;
#include &lt;vector&gt;

std::vector&lt;at::Tensor&gt; exten_cuda_forward(at::Tensor a) {
  // Do nothing.

  // Return empty vector (just for compile error demo).
  return {};
}

std::vector&lt;at::Tensor&gt; exten_cuda_backward(at::Tensor a) {
  // Do nothing.

  // Return empty vector (just for compile error demo).
  return {};
}"><pre class="notranslate"><code class="notranslate">#include &lt;torch/torch.h&gt;
#include &lt;cuda.h&gt;
#include &lt;cuda_runtime.h&gt;
#include &lt;vector&gt;

std::vector&lt;at::Tensor&gt; exten_cuda_forward(at::Tensor a) {
  // Do nothing.

  // Return empty vector (just for compile error demo).
  return {};
}

std::vector&lt;at::Tensor&gt; exten_cuda_backward(at::Tensor a) {
  // Do nothing.

  // Return empty vector (just for compile error demo).
  return {};
}
</code></pre></div>
<h2 dir="auto">System Info</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Collecting environment information...
PyTorch version: 0.4.1
Is debug build: No
CUDA used to build PyTorch: 9.2

OS: Microsoft Windows 10 Education
GCC version: (x86_64-posix-seh, Built by strawberryperl.com project) 7.1.0
CMake version: version 3.12.0

Python version: 3.7
Is CUDA available: Yes
CUDA runtime version: 9.2.148
GPU models and configuration: GPU 0: GeForce GTX 1060 6GB
Nvidia driver version: 399.07
cuDNN version: Could not collect

Versions of relevant libraries:
[pip] numpy (1.15.1)
[pip] torch (0.4.1)
[pip] torchvision (0.2.1)
[conda] cuda92                    1.0                           0    pytorch
[conda] pytorch                   0.4.1           py37_cuda92_cudnn7he774522_1  [cuda92]  pytorch
[conda] torchvision               0.2.1                     &lt;pip&gt;"><pre class="notranslate"><code class="notranslate">Collecting environment information...
PyTorch version: 0.4.1
Is debug build: No
CUDA used to build PyTorch: 9.2

OS: Microsoft Windows 10 Education
GCC version: (x86_64-posix-seh, Built by strawberryperl.com project) 7.1.0
CMake version: version 3.12.0

Python version: 3.7
Is CUDA available: Yes
CUDA runtime version: 9.2.148
GPU models and configuration: GPU 0: GeForce GTX 1060 6GB
Nvidia driver version: 399.07
cuDNN version: Could not collect

Versions of relevant libraries:
[pip] numpy (1.15.1)
[pip] torch (0.4.1)
[pip] torchvision (0.2.1)
[conda] cuda92                    1.0                           0    pytorch
[conda] pytorch                   0.4.1           py37_cuda92_cudnn7he774522_1  [cuda92]  pytorch
[conda] torchvision               0.2.1                     &lt;pip&gt;
</code></pre></div>
<ul dir="auto">
<li>PyTorch or Caffe2: PyTorch</li>
<li>How you installed PyTorch (conda, pip, source): conda</li>
<li>OS: Windows 10 x64</li>
<li>PyTorch version: 0.4.1</li>
<li>Python version: 3.7</li>
<li>CUDA/cuDNN version: 9.2</li>
<li>GPU models and configuration: GTX 1060 6GB</li>
<li>MSVC version (if compiling from source): 15.7.5</li>
<li>CMake version: 3.12.0</li>
<li>Versions of any other relevant libraries:  setuptools 0.2.1</li>
</ul>