I’m setting up an initial project using Cursor.ai with C++ and Libtorch, but I keep encountering an error that says it can’t find #include <torch/torch.h>
. The code compiles and runs fine, so the issue isn’t with the code itself; it’s just that the editor cannot locate the path. In VSCode, I’ve already added an includePath
in .vscode/c_cpp_properties.json
, and I’ve also tried moving the directory under .cursor
and reopening the project, but the error persists, saying it can’t find torch.h
. However, in VSCode, I can navigate to the header file without issues. Is there any way to fix this?
Hi @kci
Could you please confirm if you have any extensions installed for C++? And could you check that the paths to LibTorch are correct? If everything works in VS Code, please double-check your settings.
I opened a file in the same workspace with VSCode and confirmed that I could navigate to the torch.h
file correctly in the editor. Then, I reinstalled Cursor, applied my VSCode settings (including extensions), and verified that all the same extensions were installed. After opening the workspace, however, when I hover over torch.h
, it just displays “[loading…]” and fails to resolve symbols. Given that even standard libraries like iostream
are not found, it seems like a path configuration issue. Is there anything else I should do? I also tried copying the .vscode
folder to .cursor
as an additional step.