我有一个定义了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文件。
答案 0 :(得分:0)
将此代码段添加到您的代码中:
int main(void) {}
您的程序中缺少main
函数。