How to fix intellisense 'A definition for the symbol could not be located' on WSL
Asked Answered
M

2

6

I am building a solution in Visual Studio 2017 where we are cross compiling on WSL for a ARM64 target.

I have all of my include paths set up and compilation seems to work for this specific file. The headers under question are located on the W:\ drive which is the WSL filesystem

At the top of the file at the #include line I can click on the header in question () and right-click to open the document. This opens the correct header and my definition is in this newly opened document. Intellisense does seem to not be working correctly on this file as none of the enumerations or definitions seem to be highlighted correctly.

But if i were to go to the use of the definition in my .c file and try to go to the definition I get a "A definition for the symbol 'V4L2_PIX_FMT_HEVC' could not be located"

When moving the header in question to the C:\ drive and changing the include paths to the corresponding new path Intellisense seems to recognize the definition and 'go to definition' works properly

#include <linux/videodev2.h> //Open document works
#include <linux/v4l2-controls.h> //Open document works

...
case UDP_VIDEO_PROTOCOL_MPEG2:
    codec = V4L2_PIX_FMT_MPEG2; //Go to definition does not work
    break;
case UDP_VIDEO_PROTOCOL_H265:
    codec = V4L2_PIX_FMT_HEVC; //Go to definition does not work

Mart answered 5/2, 2019 at 20:28 Comment(0)
T
1

In VS 2019, I could fix this problem by deleting the CMake cache and then rebuilding the solution: Project > CMake Cache > Delete Cache. We no longer use VS project files. If you are still using VS project files, there may be a similar reset possible.

Thoracotomy answered 3/11, 2022 at 13:26 Comment(0)
M
0

Looks like the issue stems from files being created in WSL not working with Intellisense

https://developercommunity.visualstudio.com/content/problem/259166/intellisense-not-working-for-files-created-under-w.html

Apparently as of writing the issue was supposedly fixed in Visual Studio 2019 but i have not been able to test yet. It is not easy to switch over my workplace to a Preview version of visual studio just to fix the issue.

Mart answered 7/2, 2019 at 18:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.