简体   繁体   English

包含 header 文件或 cpp 文件

[英]Include header file or cpp file

I have a class.h file and a class.cpp file that has the implementations of methods in class.h.我有一个 class.h 文件和一个 class.cpp 文件,其中包含 class.h 中方法的实现。 The class.cpp has an #include < class.h> statement. class.cpp 具有 #include <class.h> 语句。 In my main.cpp, should I include < class.h> or < class.cpp>?在我的 main.cpp 中,我应该包含 <class.h> 还是 <class.cpp>?

You should include the ".h" file (Header file).您应该包含“.h”文件(头文件)。 A header file is a file which contains the function declarations and macro definitions to be shared between the source files ".cpp". header 文件是包含要在源文件“.cpp”之间共享的 function 声明和宏定义的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM