허당 레몬도리

출처 : https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html


Both user and system header files are included using the preprocessing directive ‘#include’. It has two variants:

사용자와 시스템 헤더 파일은 모두 사전 처리 지침 '#include'를 사용하여 포함된다. 두 가지 변형이 있다.

#include <file>

This variant is used for system header files. It searches for a file named file in a standard list of system directories. You can prepend directories to this list with the -I option (see Invocation).

이 변형은 시스템 헤더 파일에 사용된다. 시스템 디렉토리 표준 목록에서 파일 이름의 파일을 검색한다. -I 옵션을 사용하여 디렉터리를 이 목록에 미리 보낼 수 있다(초대 참고).

#include "file"

This variant is used for header files of your own program. It searches for a file named file first in the directory containing the current file, then in the quote directories and then the same directories used for <file>. You can prepend directories to the list of quote directories with the -iquote option.

이 변형은 당신 자신의 프로그램의 헤더 파일에 사용된다. 그것은 먼저 현재 파일이 들어 있는 디렉토리에서 파일 이름을 가진 파일을 검색한 다음, 인용문 디렉토리에서 그리고 나서 <파일>에 사용된 것과 동일한 디렉토리에서 검색한다. -iquote 옵션을 사용하여 디렉토리를 따옴표 디렉토리 목록에 미리 보낼 수 있다.

The argument of ‘#include’, whether delimited with quote marks or angle brackets, behaves like a string constant in that comments are not recognized, and macro names are not expanded. Thus, #include <x/*y>specifies inclusion of a system header file named x/*y.

인용 마크나 각도 괄호로 구분되어 있건 간에 '#include'의 주장은 그 논평에서 문자열 상수처럼 동작하며, 매크로 이름은 확장되지 않는다. 따라서 #include <x/*y>는 x/*y라는 시스템 헤더 파일의 포함을 명시한다.


However, if backslashes occur within file, they are considered ordinary text characters, not escape characters. None of the character escape sequences appropriate to string constants in C are processed. Thus, #include "x\n\\y" specifies a filename containing three backslashes. (Some systems interpret ‘\’ as a pathname separator. All of these also interpret ‘/’ the same way. It is most portable to use only ‘/’.)

그러나 파일 내에서 백슬래시가 발생하면 탈출 문자가 아닌 일반 텍스트 문자로 간주된다. C의 문자열 상수에 적합한 문자 탈출 시퀀스는 처리되지 않는다. 따라서 #include "x\n\y"는 3개의 백슬래시를 포함하는 파일 이름을 지정한다. (일부 시스템에서는 '\'를 경로 이름 구분 기호로 해석한다.) 이 모든 것들은 또한 '/'를 같은 방식으로 해석한다. '/'만 사용하는 것이 가장 휴대성이 좋다.)


It is an error if there is anything (other than comments) on the line after the file name.

파일 이름 뒤에 줄에 (주석 이외의) 것이 있으면 에러다.


번역 : 파파고 

profile

허당 레몬도리

@LemonDory

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!