【发布时间】:2014-02-25 18:58:03
【问题描述】:
上周在这里问了一个关于有两个 main() 的问题。昨晚试了一下,出现了这个错误。请看一看。 我的头文件(top.h):
#ifndef TOP_H_
#define TOP_H_
#include <stdio.h>
#include <string.h>
#define onemain main()
#define twomain main()
void print();
#endif /* TOP_H_ */
c源文件一(one.c):
#include "top.h"
void print();
int onemain()
{
print();
return 0;
}
void print()
{
printf("hello one");
}
c源文件二(two.c):
#include "top.h"
void print();
int twomain()
{
print();
return 0;
}
void print()
{
printf("hello two");
}
谢谢你们!
【问题讨论】:
-
你能把相关的错误拉出来吗?仅将错误放在图像中通常是不受欢迎的。