VSCode(Mac) 2020의 C++ std_lib_facilities.h 파일 (C++ std_lib_facilities.h file in VSCode (Mac) 2020)


문제 설명

VSCode(Mac) 2020의 C++ std_lib_facilities.h 파일 (C++ std_lib_facilities.h file in VSCode (Mac) 2020)

저는 프로그래밍 방법을 배우기 시작했습니다. 내 Mac과 C/C++ 확장에 VSCode를 설정했습니다. 나는 Stroustrup의 Programming and Principles 책에서 helloworld 프로그램을 작성했습니다. 내 helloworld.cpp 파일과 같은 폴더에 std_lib_facilities.h 파일을 넣습니다. 여전히 오류 메시지가 나타납니다. #include 오류가 감지되었습니다. includePath를 업데이트하십시오. 이 번역 단위에 대해 물결선이 비활성화되어 있습니다.

왜 여전히 오류가 발생합니까? 책에 따르면 내가 필요한 것은 .cpp 프로그램과 동일한 디렉토리에 std_lib_facilities.h.txt 파일을 저장하는 것뿐입니다. 같은 폴더에 있는데 왜 이 오류가 발생합니까?

내 코드:

#include "std_lib_facilites.h"

int main()
{
    cout << "Hello World \n";
    return 0;
}

참조 솔루션

방법 1:

First of all, you have a typo in the filename.

#include "std_lib_facilites.h"

It should be std_lib_facilities.h (source 1, source 2). And make sure to save it as .h.

Second, you can configure a .vscode/c_cpp_properties.json file to specify the path to the header files. See the VS Code docs for the JSON schema reference.

  1. Open the Command Palette
  2. Select "C/C++: Edit Configurations (JSON)"
  3. Set the includePath
 "configurations": [
     {
         "name": "Mac",
         "includePath": [
             "${workspaceFolder}/**",
             "/path/to/headers"
         ],
         ...
     }
 ],

By default it already has "${workspaceFolder}/**" which should search for header files in your workspace (and its sub‑folders). But you can also specify paths to other folders.

(by STRICKLAND_7Gino Mempin)

참조 문서

  1. C++ std_lib_facilities.h file in VSCode (Mac) 2020 (CC BY‑SA 2.5/3.0/4.0)

#C++ #visual-studio-code






관련 질문

파일의 암호화/복호화? (Encryption/ Decryption of a file?)

이상한 범위 확인 연산자가 있는 C++ typedef (C++ typedef with strange scope resolution operator)

개체 배열 매개변수--오류: '문자' 필드에 불완전한 유형이 있습니다. (Object array parameter--error: field ‘letters’ has incomplete type)

C++에서 메모리 삭제 (Deleting memory in c++)

C++ 프로그램을 실행할 수 없습니다. No se ejecuta el programa (C++ i can't run a program. No se ejecuta el programa)

컴파일 시 변수의 이름과 수명 (Name and lifetime of variables at compile time)

control-c 후 Visual Studio 콘솔 프로그램 충돌 (visual studio console program crashes after control-c)

멤버 변수에 std::enable_if 또는 유사한 메서드 사용 (Using std::enable_if or similar method on member variable)

ifstream input_file(filename); (I am receiving an error "no matching function to call" in the line ifstream input_file(filename);)

ESP8266에서 잠시 실행하면 JsonData 크기가 0이 됩니다. (JsonData size becomes zero after awhile of running in ESP8266)

합에 대한 속도 문제(제수의 합) (Speed problem for summation (sum of divisors))

벡터 벡터에서 하위 벡터의 첫 번째 값을 찾기 위해 begin() 및 end() 반복기의 범위를 지정하는 방법은 무엇입니까? (How to specify a range for begin() and end() iterators to find first value of sub vector in a vector of vectors?)







코멘트