OS: Win10 x64
LibTorch Version: 1.3.1
I downloaded libtorch from the following links:
Download here (Release version):
https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.3.1.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.3.1.zip
Then I add a new console application in VS2017 community edition. The whole solution contains only a main.cpp:
#include <torch/script.h> // One-stop header.
#include <iostream>
#include <memory>
int main(int argc, const char* argv[]) {
if (argc != 2) {
std::cerr << "usage: example-app <path-to-exported-script-module>\n";
return -1;
}
torch::jit::script::Module module;
try {
// Deserialize the ScriptModule from a file using torch::jit::load().
module = torch::jit::load(argv[1]);
}
catch (const c10::Error& e) {
std::cerr << "error loading the model\n";
return -1;
}
std::cout << "ok\n";
}
(from this tutorial: Loading a TorchScript Model in C++ — PyTorch Tutorials 2.2.0+cu121 documentation)
Then I add the include folders and lib directories. But I cannot successfully compile this solution. The error saying:
I’ve googled this issue several days, but I still not find the key to it.
I’ve checked the Release/Debug mode, set off the Conformance mode, compile libtorch from source…
all failed.
Can anyone help me solve this problem? Any suggestions will be apreciated!