如何确定源文件的编译顺序?

问题描述:

我有一个包含许多* .c文件的工作空间,我可以对其进行编译. (我可以使用任何工具链,例如MSVC6.0或gcc等)

I have a workspace containing many *.c files, which I compile. (I could use any toolchain say MSVC6.0, or gcc etc)

首先编译哪个源文件?

随后如何确定要编译的文件的顺序?

How is the order of the files to be compiled subsequently decided?

C标准未指定编译顺序.

The order of compilation is not specified by the C standard.

由于不需要像C ++中那样构造全局对象,因此在C中不会出现与编译顺序相关的情况.

Since there is no need for the construction of global objects like in C++, there is no situation where the order of compilation is relevant in C.