Reputation: 744
I started working as a research fellow at my university and was instructed to develop a component for an already existing application written in C++ using an in-house framework, also developed in C++.
Currently I am struggling with properly setting up the project in Visual Studio 2017. Whenever I try to include a file from the framework, IntelliSense complains about not being able to open the file.
However, following things add to the oddness of the problem:
The solutions properties are set correctly; the project DOES build without any complaints.
Writing the '#include'-directive, IntelliSense DOES suggest the correct relative path to the header files (i.e. #include <framework/class.h>
).
I can open the header file from within the source file referencing it, using the 'Open Document "class.h"' dialog.
I have already came across this:
So far, nothing solved my issue. Did someone come across this issue yet?
TL;DR
EDIT:
I am working on a MacBook "13 2016; installed Windows 10 Pro 64-bit via Bootcamp.
Upvotes: 8
Views: 5145
Reputation: 21
I had a similar problem with Visual Studio Code and its Intellisense C++ extension working in a cross-compile environment (using SysGCC).
The VS code IntelliSense plugin didn't find the source files. I had 'fsutil'-ed the 'C:\SysGCC...' and the checkout source directory to be 'case sensitive' (to avoid naming conflicts with Linux case-sensitive files). So, it may help to turn off the case-sensitiveness for your directories with the 'fsutils', too.
(According to VSCode-CppTools and the checkout to 'case sensitive', they have an option C_Cpp.caseSensitiveFileSupport for that, too.)
Upvotes: 0
Reputation: 806
For a Linux project open in Visual Studio 2022, I tried the accepted answer from @yothsoggoth, , which makes sense to me, but unfortunately didn't work.
I realized that visual studio couldn't even open the C++ file from the standard library using F12 but it could open others from other libraries.
So in my case the solution was to close visual studio, backup the folder working as a cache.
C:\Users\[user]\AppData\Local\Microsoft\Linux
to C:\Users\[user]\AppData\Local\Microsoft\Linux.bak
Then I reopened Visual Studio and let CMake to regenerate the cache.
The errors now are gone and I can now even open <string>
and others from the C++ std library with F12.
I hope this workaround helps others
Upvotes: 0
Reputation: 433
This issue occurs because Windows now has the option for making folders case-sensitive and intellisense has a habit of changing the case of files that it tries to open.
Intellisense tries to use a path like C:\WORKSPACEPATH\PROJECTDIR\MYFILE.cpp (i.e. all uppercase), but if C:\workspace (or any of the other directories in the path) are set to be case-sensitive and don't exactly match, it won't be found.
In my case it was because I created the folder via WSL which enables case sensitivity by default on any new directories it creates (including via things like git clone
). See here
Easy Fix
This can be fixed by running the following:
fsutil file setCaseSensitiveInfo <directory> disable
More Commands
You can check whether a folder has case sensitivity enabled by running
fsutil file queryCaseSensitiveInfo <directory>
and Finally, a handy one-liner to disable this recursively:
for /r /d %f in (.) do (fsutil file setCaseSensitiveInfo %f disable)
(This info was originally posted as a comment to the original question, before it turned out it was in fact the same problem. See the comments for input from a couple of other people)
Upvotes: 6