microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

[Windows] include files not found if case sensitive #8239

Open ECquadrat opened 3 years ago

ECquadrat commented 3 years ago

Bug type: Language Service

Hey guys, there is some weird behavior when using case sensitive file names in #include statements.

I created an empty .c file and added the following code:

include

include "vstdlib.h"

include "D:/svn/ProjectXx/Appl/CoreMsr/BSW/StbM/StbM.h"

include "StbM.h"

include

1) Now Intellisense shows a wiggled line below "D:/svn/ProjectXx/Appl/CoreMsr/BSW/StbM/StbM.h" but this file exists at this place in the file system. The line "StbM.h" below is correctly found (without wiggled line) and it's possible to open the file with "go to definition".

2) Now I comment out the include line with "D:/svn/ProjectXx/Appl/CoreMsr/BSW/StbM/StbM.h". As result there is a wiggled line below "StbM.h" now, and it shows the error "file not found in include path".

3) If I rename the "StbM.h" file to "stbm_test.h" and change the include statement, the file is found with full path name as well with file name only.

4) During typing the code, the code complete feature has no file name suggestion when starting typing with "D:/" part of filename. Nevertheless the full path include is afterwards correctly acknowledged and used by Intellisense even the code complete feature doesn't work. The other way round, when typing "Stb" without full path, there are correct suggestions with the filename "StbM.h" in the code completion but Intellisense fails when parsing afterwards and a wiggled line is drawn below.

It seems for me like in topic (1) the file has been correctly found with full pathname and parsed, but Intellisense shows a wrong wiggled line. In the next line with the include with file-name only, Intellisense recognizes this file as already available in it's database and accepts that line even the file may NOT really be found in filesystem. Maybe because of that the in test topic (2) a wiggled line is drawn below.

Is there any hint for a workaround to this issue? Please ask for more information if required.

Thanks a lot in advance, Marc

My configuration: OS: Windows 10 1909 NTFS file system in "D:\" Visual Studio Code 1.60.2 VS Code 1.6.0 All other extensions disabled Single Workspace project (right click on folder "Appl" and selected "open with Code") Intellisense Include-path: "${workspaceFolder}/**" Intellisense Exclude-path is empty

bobbrow commented 3 years ago

Could you run the C/C++: Log Diagnostics command while this file is open in the editor and share the results with us? Just want to see what your configurations look like. If you are working with case-sensitive folders in Windows, this could be a duplicate of #1994.

ECquadrat commented 3 years ago

Hi, How do I discover if the admin enabled or disabled case-sensitive folders on my Windows?

I've attached the diagnostics result. The wiggled line occurs when trying to include "StbM.h" in Ct_Vdp_DiagSource_Eval.c. Please don't be confused, there is a copy of this file open, too, named "Ct_Vdp_DiagSource_Eval - Kopie.c". The issue occurs having the copy file "...- Kopie.c" open or not. I hope this helps. Regards, Marc

-------- Diagnostics - 11.10.2021, 07:11:49
Version: 1.6.0
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.17763.0",
    "compilerPath": "C:\\Program Files (x86)\\Microsoft Visual Studio 15.0\\VC\\Tools\\MSVC\\14.16.27023\\bin\\Hostx64\\x64\\cl.exe",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerArgs": [],
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ D:\svn-proj\BEA2_VDP\Appl\Source\Templates\Ct_Vdp_DiagSource_Eval.c ]:
    D:\SVN-PROJ\BEA2_VDP\APPL\SOURCE\TEMPLATES\CT_VDP_DIAGSOURCE_EVAL.C
    D:\SVN-PROJ\BEA2_VDP\APPL\SOURCE\TEMPLATES\BSW\CDD\VDPCDDAPPL\VDPCDD.H
[ D:\SVN\VDPComponentEvaluation\trunk\examples\can_lin_eth\msr\Appl\CalloutStubs\Ct_Vdp_DiagSource_Eval - Kopie.c ]:
    D:\SVN\VDPCOMPONENTEVALUATION\TRUNK\EXAMPLES\CAN_LIN_ETH\MSR\APPL\CALLOUTSTUBS\CT_VDP_DIAGSOURCE_EVAL - KOPIE.C
    D:\SVN-PROJ\BEA2_VDP\APPL\SOURCE\TEMPLATES\BSW\CDD\VDPCDDAPPL\VDPCDD.H
Translation Unit Configurations:
[ D:\svn-proj\BEA2_VDP\Appl\Source\Templates\Ct_Vdp_DiagSource_Eval.c ]:
    Process ID: 14504
    Memory Usage: 36 MB
    Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio 15.0\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.exe
    Includes:
        C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 15.0\VC\TOOLS\MSVC\14.16.27023\INCLUDE
        C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 15.0\VC\TOOLS\MSVC\14.16.27023\ATLMFC\INCLUDE
        C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\UM
        C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\UCRT
        C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\SHARED
        C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\WINRT
        C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\CPPWINRT
        D:\SVN-PROJ\BEA2_VDP\APPL\SOURCE\GENDATA\COMPONENTS
        D:\SVN-PROJ\BEA2_VDP\APPL\COREMSR\BSW\VSTDLIB
        D:\SVN-PROJ\BEA2_VDP\APPL\SOURCE\TEMPLATES\BSW\CDD\VDPCDDAPPL
        D:\SVN-PROJ\BEA2_VDP\APPL\COREMSR\BSW\COMM
        D:\SVN-PROJ\BEA2_VDP\APPL\COREMSR\BSW\VTTCANOEEMU
        D:\SVN-PROJ\BEA2_VDP\APPL\COREMSR\BSW\STBM
        D:\SVN-PROJ\BEA2_VDP\APPL\SOURCE\GENDATA
        D:\SVN-PROJ\BEA2_VDP\APPL\COREMSR\MISC\RTEANALYZER\INCLUDE
        D:\SVN-PROJ\BEA2_VDP\APPL\SOURCE\INT
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c17
    IntelliSense Mode: windows-msvc-x64
[ D:\SVN\VDPComponentEvaluation\trunk\examples\can_lin_eth\msr\Appl\CalloutStubs\Ct_Vdp_DiagSource_Eval - Kopie.c ]:
    Process ID: 10876
    Memory Usage: 34 MB
    Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio 15.0\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.exe
    Includes:
        C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 15.0\VC\TOOLS\MSVC\14.16.27023\INCLUDE
        C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 15.0\VC\TOOLS\MSVC\14.16.27023\ATLMFC\INCLUDE
        C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\UM
        C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\UCRT
        C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\SHARED
        C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\WINRT
        C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\CPPWINRT
        D:\SVN-PROJ\BEA2_VDP\APPL\SOURCE\GENDATA\COMPONENTS
        D:\SVN-PROJ\BEA2_VDP\APPL\COREMSR\BSW\STBM
        D:\SVN-PROJ\BEA2_VDP\APPL\COREMSR\BSW\VSTDLIB
        D:\SVN-PROJ\BEA2_VDP\APPL\SOURCE\TEMPLATES\BSW\CDD\VDPCDDAPPL
        D:\SVN-PROJ\BEA2_VDP\APPL\COREMSR\BSW\COMM
        D:\SVN-PROJ\BEA2_VDP\APPL\COREMSR\BSW\VTTCANOEEMU
        D:\SVN-PROJ\BEA2_VDP\APPL\SOURCE\GENDATA
        D:\SVN-PROJ\BEA2_VDP\APPL\COREMSR\MISC\RTEANALYZER\INCLUDE
        D:\SVN-PROJ\BEA2_VDP\APPL\SOURCE\INT
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c17
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 70 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 18941

------- Potential include path issues --------
Some headers exist in multiple locations. If IntelliSense is behaving incorrectly,
try adding one of the alternate paths to the "includePath" in your configuration in
c_cpp_properties.json to override the automatic path discovery for that header.

Using: D:/svn-proj/BEA2_VDP/Appl/CoreMsr/Misc/RteAnalyzer/include/ComStack_Types.h
    Alternative: "D:/svn-proj/BEA2_VDP/Appl/CoreMsr/BSW/Vtt_Common"
    Alternative: "D:/svn-proj/BEA2_VDP/Appl/CoreMsr/BSW/_Common"
Using: D:/svn-proj/BEA2_VDP/Appl/CoreMsr/Misc/RteAnalyzer/include/MemMap.h
    Alternative: "D:/svn-proj/BEA2_VDP/Appl/CoreMcal/Mcal_Tc2xx/Supply/BASE_V700_REL-405/TC27x_DCstep/Aurix_MC-ISAR/demoapp/tricore/compiler"
    Alternative: "D:/svn-proj/BEA2_VDP/Appl/Source/Int"
Using: D:/svn-proj/BEA2_VDP/Appl/CoreMsr/Misc/RteAnalyzer/include/Platform_Types.h
    Alternative: "D:/svn-proj/BEA2_VDP/Appl/CoreMcal/Mcal_Tc2xx/Supply/BASE_V700_REL-405/TC27x_DCstep/Aurix_MC-ISAR/general/tricore/inc"
Using: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt/string.h
    Alternative: "D:/svn-proj/BEA2_VDP/Appl/CoreMsr/Misc/RteAnalyzer/include"
mrx23dot commented 4 months ago

Just a note, if you ignore case sensitivity your code won't be platform independent.