λ°μν
π‘ λ³Έ λ¬Έμλ 'C++ #include ν€λνμΌ μμ'μ λν΄ μ 리ν΄λμ κΈμ λλ€.
C++ #include ν€λνμΌ μμ κ΄λ ¨ λ¬Έμλ₯Ό μ°Ύμ보λ€λ³΄λ ꡬκΈμ κ°μ΄λλ μ κ° μ΄μ μ νλ λ°©μκ³Όλ μ λ°λμμ΅λλ€. μ λ΅μ μμ§λ§ κ΄λ ¨ λ΄μ©μ λν΄ μ 리νμμΌλ μ°Έκ³ νμκΈ° λ°λλλ€.
1. Google Styleguide
For example, the includes in google-awesome-project/src/foo/internal/fooserver.cc might look like this
#include "foo/server/fooserver.h"
#include <sys/types.h>
#include <unistd.h>
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "foo/server/bar.h"
#include "third_party/absl/flags/flag.h"
2. Dependency
For example, fooserver.cc might look like this
#include "foo/server/fooserver.h"
#include "base/basictypes.h"
#include "foo/server/bar.h"
#include "third_party/absl/flags/flag.h"
#include <string>
#include <vector>
#include <sys/types.h>
#include <unistd.h>
λ§λ¬΄λ¦¬
μμ λ λ§ν¬λ ν€λ μ μΈ μμ κ΄λ ¨λ λ΄μ©μ λλ€. ν€λ μμλ₯Ό μ ν λ μ’ μμ±μ μννκΈ° μν΄ μ€ν μ€λ²νλ‘μ° λ§ν¬μμ μ μν λ°©λ²μ 보νΈμ μΌλ‘ μ¬μ©νλ κ±° κ°μ΅λλ€. νμ§λ§ ꡬκΈμμλ ν΄λΉ νμΌμ ν€λλ₯Ό μ μΈν μ΄ν μμμ μΈκΈν λ°©λ²κ³Ό μ λ°λλ‘ μ μΈνκ² λ©λλ€. κ΅¬κΈ λ΄λΆμμ νλ‘μ νΈλ₯Ό λΉλν λ μμκ° λ€λ₯Έκ±΄μ§ μ νν μ΄μ λ λͺ¨λ₯΄κ² μΌλ, λΉλμ μ’ μμ±μ μκ°νλ€λ©΄ μ€ν μ€λ²νλ‘μ°μμ μΈκΈν νμκ° λ§μ κ² κ°κΈ΄ ν©λλ€.
μ°Έκ³
- [StackOverFlow] C/C++ include header file order: https://stackoverflow.com/questions/2762568/c-c-include-header-file-order#:~:text=%22Thinking%20in%20C%2B%2B%22%20in%20particular%20mentions%20this%2C%20referencing%20Lakos%27%20%22Large%20Scale%20C%2B%2B%20Software%20Design%22
- [Google Styleguide] cppguide: https://google.github.io/styleguide/cppguide.html#Self_contained_Headers:~:text=Include%20headers%20in%20the%20following%20order%3A%20Related%20header%2C%20C%20system%20headers%2C%20C%2B%2B%20standard%20library%20headers%2C%20other%20libraries%27%20headers%2C%20your%20project%27s%20headers.
λ°μν
'Study: Software(SW) > SW: Language' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[Error Fix] JAVA μ¬μ€μΉ ν λ§νΉ λ¬Έμ (feat. JAVA λ²μ λ³κ²½) (2) | 2023.01.20 |
---|---|
[JAVA] JVM vs JDK vs JRE? (javaμ javacμ λ²μ λ° μ€μΉκ²½λ‘ μμ보기) (0) | 2023.01.19 |
[Rust] Rustκ° λ¨λ μ΄μ λ° λ¬Έλ² νΉμ§ (0) | 2023.01.07 |
[IDE] VSCode Rust κ°λ°νκ²½ μ€μ (MacOS M1) (0) | 2023.01.04 |
[Python] Python λ¨μ ν μ€νΈ(Unit Test): unittest μ¬μ©λ² (2) | 2022.12.08 |