Libtorch isn't in the {PATH} VS22 Template Problem

Hey. I am trying to create a pytorch tutorial project with C++. I have downloaded the latest versions of “libtorch-win-shared-with-deps-2.0.1+cpu” and “libtorch-win-shared-with-deps-debug-2.0.1+cpu” for both debug and release. And extracted them. And downloaded the pre-configured LibTorch project for VS22.
Everything seems fine until I encountered the problem when try to select folder for both debug and release files. Can anyone help me?

– I have tried to select multiple path inside libtorch file such as lib, bin and include. But it does not work.

Message comes from here: Github code link
It expects your selected folder containts folder named ‘libtorch’.

Thanks for the reply. After inspecting the code, I’ve successfully managed to adjust the folder structure to match the code format. Now i can not include any headers. I tried to configure additional include libraries setting in properties menu of the project but it did not help. The template is pre-configured and i don’t want to change the settings too much. What else can i do?

I had the same problem and solved it.

In your list of Errors, if the last one is about not having a specific Windows SDK version. You can either get that SDK or retarget SDK.

I retargeted the SDK: Go to Solution’s properties->Configuration Properties->General->Windows SDK Version. There is a list of versions you can select. I selected the “10.0(latest installed version)”.

After I retargeted the Windows SDK all the errors disappeared and I am able to run the cpp script and it shows my CUDA and GPU was detected and integrated with LibTorch. Hope this helps.