将 *.hpp 或 *.cpp 文件包含在 *.h 文件中哪个更好

时间:2021-05-26 12:53:44

标签: c++

我必须运行 Makefile。其中包括此命令之一 g++ file1.o file2.o file3.h -o output

我的文件就像:-.

file1.cpp

#include<iostream>
#include "file2.h"
#include "file3.h"
using namespace std;
 -----
------
-----

我有 file3.h

#include<something>
#ifndef X
#define X
-----
function declaration
-----
-----

#include "file3.hpp"
#endif

file3.hpp

#include "file3.h"
------
-----
function definition
--------

请指导我。

我可以在file3.h中定义file3.hpp的函数还是应该使用file3.cpp来定义file3.h的函数。

0 个答案:

没有答案
相关问题