vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

filesystem library file cannot be recognized

Open zhiquan114514 opened this issue 2 years ago • 3 comments

Environment

  • OS and Version: Windows 10
  • VS Code Version: 1.84.0
  • C/C++ Extension Version: v1.18.5
  • If using SSH remote, specify OS of remote machine:

Bug Summary and Steps to Reproduce

Bug Summary: when debugging or running code, filesystem is not a member error of std occurs with the library imported and namespace specified my code is tested on CLion and Visual Studio with no errors Steps to reproduce:

  1. Open the code file
  2. Click on run/debug
  3. See error

Expected behavior: compile should pass without error

Configuration and Logs

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.22621.0",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}

Other Extensions

No response

Additional context

No response

zhiquan114514 avatar Dec 14 '23 23:12 zhiquan114514

Hi @zhiquan114514 . Could you provide example code? Can you clarify if the issue you are seeing is due to an IntelliSense error (squiggle), or something else? I'm able to use the filesystem header and namespace without any IntelliSense errors, with a simple example and default settings on Windows:

#include <iostream>
#include <filesystem>

namespace fs = std::filesystem;

int main() {
    // Define the path for the new directory
    fs::path dirPath = "example_dir";

    // Check if the directory already exists
    if (!fs::exists(dirPath)) {
        // Create the directory
        fs::create_directory(dirPath);
        std::cout << "Directory created: " << dirPath << std::endl;
    } else {
        std::cout << "Directory already exists: " << dirPath << std::endl;
    }

    return 0;
}

Assuming you're referring to an IntelliSense issue, could you provide the output of the C/C++: Log Diagnostics command while that file is open?

Colengms avatar Dec 14 '23 23:12 Colengms

@Colengms I don't think it is a intelliSense error, I hit the debug button then everything appears. And I compile the example code you gave. However I do notice there there is a warning indicating that i am not using c++17 but actually I am using it. image

zhiquan114514 avatar Dec 15 '23 01:12 zhiquan114514

Hi @zhiquan114514 . That warning would appear to be coming from another extension. Problems logged by the C/C++ Extension would be indicated as C/C++, not cpp.

Colengms avatar Feb 07 '24 02:02 Colengms

This issue has been closed because it needs more information and has not had recent activity.

github-actions[bot] avatar Mar 08 '24 11:03 github-actions[bot]