Intellisense not working with Linux projects

I was having an annoying problem with intellisense in my Linux project.

Even though the project was building all completely and successfully, the error window was showing a bunch of errors saying “…cannot open source file…”.

Also if I wanted to open the file from the standard C++ library, e.g. <string> it wouldn’t open either.

I looked for an answer online using several search engines and even tried other tools like GPTChat to not avail.

I realized that I could open some other files though and they were located in a cache folder.  Browse up this folder and noticed that there were the files the Visual Studio couldn’t find.

Maybe Visual Studio (Intellisense) were not able to locate those files.  So, what if I backup the cache folder and then make Visual Studio through CMake to regenerate it.

That was it!

I closed Visual Studio.

Then renamed the folder “C:\Users\leon\AppData\Local\Microsoft\Linux” to “C:\Users\leon\AppData\Local\Microsoft\Linux.bak”.

Reopen Visual Studio and CMake started recreating the cache.

And voila!

The Intellisense errors disappeared and I can now open the file from the C++ standard library using for example the shortcut F12.

CPack postinst script error

CRLF vs LF

After generated a deb package with CPack I was having a weird error when installing with dpkg:

dpkg (subprocess): unable to execute installed devicehub package post-installation script (/var/lib/dpkg/info/devicehub.postinst): No such file or directory

So I checked the folder and tried to execute the script and it returned the same error message and that’s the moment I  remembered that I copied this file from a windows machine and realized that it probably still had the windows newline (CRLF) instead of Unix newline (LF).

After replacing CRLF with LF the script now run successfully.