我有一个源文件,其中定义了Typedef结构:
typedef struct {
unsigned int seed;
} generator;
generator *create() {
generator *g = (generator*)malloc(sizeof(generator));
g->seed = time(0);
return g;
}
void set_seed(generator *g, unsigned int s) {
g->seed = s;
}
unsigned int rand_int(generator *g) {
return g->seed = (a * g->seed) % m;
}
我需要编写标头文件,.h文件。但是我一直在得到
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
要避免此错误,请帮助我编写.H文件。
将此代码段添加到您的代码:
int main(void) {}
您是程序中缺少main
功能的一个。