我的问题是每当我尝试使用Makefile进行编译时,我得到以下内容:
make: Warning: File `Board.c' has modification time 1.3e+03 s in the future
gcc -Wall -c -Wvla -lm Board.c -o Board.o
gcc -Wall -c -Wvla -lm PlayBoard.c -o PlayBoard.o
gcc -lm ErrorHandle.o Board.o PlayBoard.o -g -o PlayBoard
make: warning: Clock skew detected. Your build may be incomplete.
Run Code Online (Sandbox Code Playgroud)
我的Makefile是:
CC = gcc
FLAGS = -Wall -c -Wvla
PlayBoard: ErrorHandle.o Board.o PlayBoard.o
$(CC) -lm ErrorHandle.o Board.o PlayBoard.o -g -o $@
PlayBoard.o: PlayBoard.c Board.o
$(CC) $(FLAGS) -lm PlayBoard.c -o $@
Board.o : ErrorHandle.o …Run Code Online (Sandbox Code Playgroud) 好吧,我正在编写带有struct [在C++中]的代码,我不确定是在头文件还是源文件中实现struct.
该struct包含一个构造函数:
struct Point
{
double x;
double y;
Point(double xCo, double yCo)
{
this->x = xCo;
this->y = yCo;
}
int comparePoint(Point point)
{
...
}
};
Run Code Online (Sandbox Code Playgroud)
我在头文件中写道:
typedef struct Point point;
Run Code Online (Sandbox Code Playgroud)
它足够好,还是一个糟糕的设计?正如我在一些网站上看到的那样,结构通常在头文件中实现,
但在之前的作业中,我[在C]课程的工作人员为我们提供了一个头文件,其中包括对结构的声明而不是实现.
我在这里看到了与此类似的其他问题,但他们并没有真正回答我的问题.