【发布时间】:2009-05-17 21:35:23
【问题描述】:
因为我见过(并使用过)这样的情况:
在 header.h 中:
class point
{
public:
point(xpos, ypos);
int x;
int y;
};
在 def.cpp 中:
#include"header.h"
point::point(xpos, ypos)
{
x = xpos;
y = ypos;
}
在 main.cpp 中:
#include"header.h"
int main()
{
point p1(5,6);
return 0;
}
我知道程序从 main 执行,但是编译器如何知道编译 .cpp 文件的顺序? (特别是如果有多个非主 .cpp 文件)。
【问题讨论】: