microsoft / vscode-cpptools

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

Not being case sensitive to files resulted in the correct dependency not being found. #11565

Open wc7086 opened 11 months ago

wc7086 commented 11 months ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary:

demo: https://github.com/wc7086/cppextdemo

Steps to reproduce:

  1. Open my demo project
  2. Building with platformio

Debugger Configurations

// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY
//
// PIO Unified Debugger
//
// Documentation: https://docs.platformio.org/page/plus/debugging.html
// Configuration: https://docs.platformio.org/page/projectconf/section_env_debug.html

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "platformio-debug",
            "request": "launch",
            "name": "PIO Debug",
            "executable": "C:/Users/*/Desktop/code/demo/demo/.pio/build/esp12e/firmware.elf",
            "projectEnvName": "esp12e",
            "toolchainBinDir": "C:/Users/*/.platformio/packages/toolchain-xtensa/bin",
            "internalConsoleOptions": "openOnSessionStart",
            "preLaunchTask": {
                "type": "PlatformIO",
                "task": "Pre-Debug"
            }
        },
        {
            "type": "platformio-debug",
            "request": "launch",
            "name": "PIO Debug (skip Pre-Debug)",
            "executable": "C:/Users/*/Desktop/code/demo/demo/.pio/build/esp12e/firmware.elf",
            "projectEnvName": "esp12e",
            "toolchainBinDir": "C:/Users/*/.platformio/packages/toolchain-xtensa/bin",
            "internalConsoleOptions": "openOnSessionStart"
        },
        {
            "type": "platformio-debug",
            "request": "launch",
            "name": "PIO Debug (without uploading)",
            "executable": "C:/Users/*/Desktop/code/demo/demo/.pio/build/esp12e/firmware.elf",
            "projectEnvName": "esp12e",
            "toolchainBinDir": "C:/Users/*/.platformio/packages/toolchain-xtensa/bin",
            "internalConsoleOptions": "openOnSessionStart",
            "loadMode": "manual"
        }
    ]
}

Debugger Logs

Processing esp12e (platform: espressif8266; board: esp12e; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp12e.html
PLATFORM: Espressif 8266 (4.2.1) > Espressif ESP8266 ESP-12E
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 @ 3.30102.0 (3.1.2) 
 - tool-esptool @ 1.413.0 (4.13) 
 - tool-esptoolpy @ 1.30000.201119 (3.0.0) 
 - toolchain-xtensa @ 2.100300.220621 (10.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 37 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\esp12e\src\eeprom.cpp.o
src\eeprom.cpp: In function 'void begin()':
src\eeprom.cpp:3:16: error: 'EEPROM' was not declared in this scope
    3 | void begin() { EEPROM.begin(4095); }
      |                ^~~~~~
src\eeprom.cpp: In function 'void end()':
src\eeprom.cpp:5:14: error: 'EEPROM' was not declared in this scope
    5 | void end() { EEPROM.end(); }
      |              ^~~~~~
Compiling .pio\build\esp12e\FrameworkArduino\FS.cpp.o
Compiling .pio\build\esp12e\FrameworkArduino\FSnoop.cpp.o
Compiling .pio\build\esp12e\FrameworkArduino\FunctionalInterrupt.cpp.o
Compiling .pio\build\esp12e\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\esp12e\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\esp12e\FrameworkArduino\LwipDhcpServer-NonOS.cpp.o
*** [.pio\build\esp12e\src\eeprom.cpp.o] Error 1
Compiling .pio\build\esp12e\FrameworkArduino\LwipDhcpServer.cpp.o
========================================================= [FAILED] Took 2.04 seconds =========================================================

Other Extensions

No response

Additional Information

Holding down the ctrl key and clicking on #include "eeprom.h" and #include <EEPROM.h> both go to eeprom.h, but clicking on the EEPROM class goes to EEPROM.h normally.

bugv

browntarik commented 11 months ago

image

Have you toggled the case sensitive file system setting yet? You may not be aware of it but it looks like it should be set to "enabled" in your case.

wc7086 commented 11 months ago

Have you toggled the case sensitive file system setting yet? You may not be aware of it but it looks like it should be set to "enabled" in your case.

I changed this option but it didn't work bugv

bobbrow commented 11 months ago

Are there two eeprom.h headers? (one EEPROM.h, and one eeprom.h?) I don't see an EEPROM.h (all caps) in your project, just the lower-cased one.

Are you looking for help with your build failure (which seems to be related to the missing EEPROM.h), or a way to configure IntelliSense so that the CTL+Click goes to EEPROM.h? I don't know how to configure your build, but to configure IntelliSense, you need to tell the extension where the all caps header/source files for EEPROM are. Run the C/C++: Edit Configurations (UI) command and then add the necessary folders into the "Include Path" box.

wc7086 commented 11 months ago

Are there two eeprom.h headers? (one EEPROM.h, and one eeprom.h?) I don't see an EEPROM.h (all caps) in your project, just the lower-cased one.

Sorry, to save time I didn't configure the include path manually, platformio automatically configures the path to EEPROM.h after calling in the dependency libraries. I'm sure I've introduced the path to that dependency library in the config file, and I can see in the gif I posted that clicking on the called class jumps to EEPROM.h correctly, but clicking on doesn't jump correctly.

PS: platformio can add dependency libraries to the project, I will upload the libraries and their path configurations in the demo in a few hours if necessary.

bobbrow commented 11 months ago

I can reproduce the problem after installing the Platform.io extension. Probably the easiest workaround until we fix this is to rename your workspace files so that they differ by more than just the casing. After renaming the local header from eeprom.h to eeprom2.h, fixing the references, and reloading the window, there were no more red squiggles in the file.

zhuliking commented 2 months ago

Do you have this set: "C_Cpp.caseSensitiveFileSupport": "enabled"