本文介绍了了解Eclipse生成的文件夹和文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题的简短版本:什么是 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?

问题的长版:


  1. 在我的主目录中,我有 workspace 目录。每当我创建一个项目并将其命名为 ProjectName 时,Eclipse就会在 workspace 文件夹。

  2. 在我的项目中,我创建了不同的类,每个类都与2个文件相关联(源文件 ClassName.cpp 和头文件 ClassName.h )。这些文件放在 workspace / ProjectName / src 文件夹中。

  3. 现在,我 Build 我在Eclipse中的项目,并在 workspace / ProjectName 中出现一个新文件夹。它称为 Debug

  4. 在此文件夹中,只有一个文件,其功能我可以理解: ProjectName 。它是可执行文件。如果我在命令行中输入名称,我的程序将被执行。

  5. 我不知道另外3个文件: objects.mk sources.mk makefile

  6. 此外,在 Debug 文件夹中有 src 目录。它包含 subdir.mk 文件以及 ClassName.o ClassName.d 文件(如果我有N个类,则会有N对 *。o *。 d 个文件。)

  1. In my home directory I have the workspace directory. Whenever I create a project and call it ProjectName a new directory (also called ProjectName) is created by Eclipse in the workspace folder.
  2. In my project I create different classes, every class is associated with 2 files (source file ClassName.cpp and header file ClassName.h). These files are put into the workspace/ProjectName/src folder.
  3. Now I Build my project in Eclipse and in the workspace/ProjectName a new folder appears. It is called Debug.
  4. 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.
  5. Another 3 files are unknown to me: objects.mk, sources.mk, makefile.
  6. Moreover, in Debug folder there is src directory. It contains subdir.mk file whose meaning is unknown to me as well as ClassName.o and ClassName.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生成的文件夹和文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 19:18