In Windows 10, how to install/include LibTorch in Visual Studio Professional 2015?

username: Mihail_DM
cooked: <p>Till now, I just downloaded the LibTorch from here <a href="https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-latest.zip" rel="nofollow noopener">https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-latest.zip</a></p>
<p>I tried to include it to my Visual Studio application project, but I still get errors with “file not found”.</p>
<p>Also, I need to have installed PyTorch 1.0 in Windows ? I downloaded the <em>model.pt</em> from Kaggle Kernels.</p>
<p>I need a complete tutorial with how I install/include LibTorch in Visual Studio.</p>

username: peterjc123
cooked: <p>It will be easier if you use CMake. If you stick to building the project using VS, then instead of dragging the directory of libtorch to your project, you should add the include directory(should be in Project settings/C++) and the libraries (should be in Project settings/Linker) in the project settings.</p>

username: Song_Zhu
cooked: <p>Could you please tell some details? Which directory should be added to settings/C++? And, which libraries should be added to settings/Linker?<br>
Thanks!</p>

username: peterjc123
cooked: <aside class="onebox githubissue">
  <header class="source">
      <a href="https://github.com/pytorch/pytorch/issues/15757#issuecomment-452113121" target="_blank" rel="nofollow noopener">github.com/pytorch/pytorch</a>
  </header>
  <article class="onebox-body">
    <a href="https://github.com/lel4866" rel="nofollow noopener">
<img src="https://avatars1.githubusercontent.com/u/1310042?v=2&amp;s=96" class="thumbnail onebox-avatar" width="420" height="420">
</a>

<h4><a href="https://github.com/pytorch/pytorch/issues/15757#issuecomment-452113121" target="_blank" rel="nofollow noopener">Issue: LibTorch C++ mnist example gets an exception on Windows 10 with Visual Studio</a></h4>

<div class="date" style="margin-top:10px;">
	<div class="user" style="margin-top:10px;">
	opened by <a href="https://github.com/lel4866" target="_blank" rel="nofollow noopener">lel4866</a>
	on <a href="https://github.com/pytorch/pytorch/issues/15757#issuecomment-452113121" target="_blank" rel="nofollow noopener">2019-01-05</a>
	</div>
	<div class="user">
	</div>
</div>

<pre class="content" style="white-space: pre-wrap;">🐛 Bug
I get an exception executing the c++ mnist example using Visual Studio on Windows 10. This is the same problem...</pre>

<div class="labels">
 	<span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">windows</span>
</div>

  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>


username: ash_gamma
cooked: <aside class="quote no-group" data-username="peterjc123" data-post="2" data-topic="33029" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/peterjc123/48/2790_2.png" class="avatar"> peterjc123:</div>
<blockquote>
<p>It will be easier if you use CMake. If you stick to building the project using VS, then instead of dragging the directory of libtorch to your project, you should add the include directory(should be in Project settings/C++) and the libraries (should be in Project settings/Linker) in the project settings.</p>
</blockquote>
</aside>
<p>Hi,</p>
<p>Could you please help me resolve issues I’m facing while trying to compile a simple cpp+libtorch code in VS 2017 on Windows:</p><aside class="quote quote-modified" data-post="1" data-topic="42750">
  <div class="title">
    <div class="quote-controls"></div>
    <img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ash_gamma/48/10052_2.png" class="avatar">
    <a href="https://discuss.pytorch.org/t/compiling-cpp-libtorch-code-in-vs-2017/42750">Compiling cpp + libtorch code in VS 2017</a> <a class="badge-category__wrapper " href="/c/c/11"><span data-category-id="11" data-drop-close="true" class="badge-category " title="Topics related to the C++ Frontend, C++ API or C++ Extensions"><span class="badge-category__name">C++</span></span></a>
  </div>
  <blockquote>
    Hello, 
Here’s my simple cpp code that just loads the model. I’m trying to compile this code in Windows 7, VS 2017. I’ve included path to libtorch/include to C++ include dirs &amp; libtorch/lib to linker 
#define _CRT_SECURE_NO_WARNINGS
#include "torch/script.h"
#include &lt;iostream&gt;
#include &lt;memory&gt;
#include &lt;fstream&gt;


#include &lt;stdint.h&gt;
#include &lt;vector&gt;

typedef unsigned char BYTE;

using namespace std;

int main(int argc, const char* argv[]) {

if (argc != 3) {
std::cerr &lt;&lt; "usage: example-app &amp;…
  </blockquote>
</aside>

<p>Thanks a lot! <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>

username: msminhas93
cooked: <p>I’ve written a tutorial on how to setup visual studio 2019 project using libtorch 1.6 <a href="https://expoundai.wordpress.com/2020/10/13/setting-up-a-cpp-project-in-visual-studio-2019-with-libtorch-1-6/" rel="noopener nofollow ugc">https://expoundai.wordpress.com/2020/10/13/setting-up-a-cpp-project-in-visual-studio-2019-with-libtorch-1-6/</a></p>
<p>The concept should be similar for other versions also.</p>