问题描述
问题的简短版本:什么是 objects.mk
, sources.mk
, makefile
, subdir.mk
, *。o
和 Eclipse生成的* .d
文件?
Short version of the question: What are objects.mk
, sources.mk
, makefile
, subdir.mk
, *.o
and *.d
files generated by Eclipse?
问题的长版:
- 在我的主目录中,我有
workspace
目录。每当我创建一个项目并将其命名为ProjectName
时,Eclipse就会在workspace
文件夹。 - 在我的项目中,我创建了不同的类,每个类都与2个文件相关联(源文件
ClassName.cpp
和头文件ClassName.h
)。这些文件放在workspace / ProjectName / src
文件夹中。 - 现在,我
Build
我在Eclipse中的项目,并在workspace / ProjectName
中出现一个新文件夹。它称为Debug
。 - 在此文件夹中,只有一个文件,其功能我可以理解:
ProjectName
。它是可执行文件。如果我在命令行中输入名称,我的程序将被执行。 - 我不知道另外3个文件:
objects.mk
,sources.mk
,makefile
。 - 此外,在
Debug
文件夹中有src
目录。它包含subdir.mk
文件以及ClassName.o
和ClassName.d
文件(如果我有N个类,则会有N对*。o
和*。 d
个文件。)
- In my home directory I have the
workspace
directory. Whenever I create a project and call itProjectName
a new directory (also calledProjectName
) is created by Eclipse in theworkspace
folder. - In my project I create different classes, every class is associated with 2 files (source file
ClassName.cpp
and header fileClassName.h
). These files are put into theworkspace/ProjectName/src
folder. - Now I
Build
my project in Eclipse and in theworkspace/ProjectName
a new folder appears. It is calledDebug
. - In this folder there is only one file whose functionality I understand:
ProjectName
. It is the executable. If I type its name in the command line, my program will be executed. - Another 3 files are unknown to me:
objects.mk
,sources.mk
,makefile
. - Moreover, in
Debug
folder there issrc
directory. It containssubdir.mk
file whose meaning is unknown to me as well asClassName.o
andClassName.d
files (if I have N classes there will be N pairs of the*.o
and*.d
files.)
请问有人可以解释这些文件的含义和目的吗?
Can anybody, please, explain the meaning and purpose of these files?
推荐答案
objects.mk
, sources.mk
, makefile
和 subdir.mk
是Eclipse根据您的项目类型生成的makefile(可执行) ,库,共享库)。有关它们的内容及其工作方式,请参考工具链的 make
命令文档。简而言之,它们负责调用编译器和链接器。
objects.mk
, sources.mk
, makefile
and subdir.mk
are makefiles generated by Eclipse according to your project type (executable, library, shared library). For their contents and how these work refer to the make
command documenation of your toolchain. In short these are responsible to call the compiler and linker.
ClassName.o
是由对象生成的目标文件。编译器,它们都将链接到可执行文件或存储在库中(取决于项目类型)。
ClassName.o
is the object file generated by the compiler, all of them will be linked together to an executable or stored in a library (depending on project type).
ClassName.d
是所谓的依赖项引用文件,由编译器(按需)生成并包含在makefile中,因此可以跟踪头文件中的更改,并在必要时重新编译相关的源文件。
ClassName.d
is a so called dependency reference file that is generated by the compiler (on demand) and included into the makefiles, that it's possible to track changes in header files, and recompile the concerned source files if neccessary.
这篇关于了解Eclipse生成的文件夹和文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!