使用gcc编译
时间:2009-05-10 来源:aberLinux
编辑了三个文件:
1.msg.h
extern void msg(void);
2.msg.c
#include <stdio.h>
void msg(void)
{
printf("msg is run!\r\n);
}
3.main.c
#include <stdio.h>
#include "msg.h"
int main(void)
{
printf("hello World!\r\n);
msg();
printf("main() run!\r\n);
}
编译发现问题:
1.使用gcc msg.c 不能编译.
2.gcc –c msg.c –o msg.o能编译,但msg.o不能执行。估计没main()函数3.使用gcc main.c msg.c –o main 生成main.exe,可执行。
相关阅读 更多 +