CLion IDE does not resolve header files when use remote host

Viewed 1671

I use CLion IDE for a small TensorRT project. The project and related libraries (Cuda, TensorRT) are both located on a ssh server. One version of the project is cloned from the server and run locally. I managed to sync project between the server and local and build the project successfully (using command line cmake and make). One problem is CLion can not resolve header files (that are located remotely, for example NvInfer.h in TensorRT libraries), therefore code auto completion also does not work. I have tried flowing workarounds:

  1. Include path to the header files to CMakeLists.txt by using include_directories()

  2. Tool -> Resync with remote hosts.

  3. Create toolchain and map remote host like in CLion official guide.

  4. I also referred to this question and other similar questions but it still does not work.

If you have successfully setup CLion for remote development, please help me. Thank you for reading.

More information:

A few days ago. I found that the header files are silently installed in .cache/JetBrains/CLion2020.3/.remote/MyHostName_PortNumber/usr/include/x86_64-linux-gnu/the_header_files.h. But now their aren't. How can i make CLion to install them again.

2 Answers

I have the same problem and I found that only part of the header files could not be parsed(unisth.h was found, but sys/stat.h did not).The real reason is that these files exist as symbolic links on my Ubuntu. During synchronization, Clion will first use tar to package the files, and then download them locally. By default, the symbolic links will not be parsed to the corresponding files.To solve this problem,I enable the clion.remote.tar.dereference key in the Registry(go to Help | Find Action or press Ctrl+Shift+A, type Registry, and search for the key by name),after that, click Tools | Resync with Remote Hosts.If it doesn't work, you may need delete your local cache manual(maybe in C:\Users\username\AppData\Local\JetBrains\CLion2021.1.remote), and click Tools | Resync with Remote Hosts.

I have just found the answer. The reason is CLion does not install header files to local because I am using a cmake version that is not supported by CLion. I uninstall cmake on the ssh server and reinstall it with CLion-supported version (3.17.1). Thank you!

Related